0

I need to check image open without error using url , When am open the image it got the message like cannot be displayed image because it contains errors.

So I got error like imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error when resize image that's why am plan to check image open without error or not before resize image.

Am tried like below code,

$url = "path/to/sample.jpg"

if(file_exits($url)) {
    echo "image exits" 
} else {
    echo "image not exists"
}

But this not working always came else part only. and also am tried like,

getimagesize($url)

but this also not worked got size in that image but it have some errors in image.

Please give me solution for my problem.

MCMXCII
  • 1,043
  • 4
  • 13
  • 26

0 Answers0