check if image exists php

前端 未结 3 1329
清酒与你
清酒与你 2021-01-11 12:24

I am in the middle of coding up a property portal. I am stuck on checking images. I know how to check if an image url is set. But the problem is detecting if there is actual

3条回答
  •  囚心锁ツ
    2021-01-11 12:57

    Use getimagesize() to ensure that the URL points to a valid image.

    if (getimagesize($imageURL) !== false) {
        // display image
    }
    

提交回复
热议问题