-1

I'm using phpThunmb to display images from external link. for some images, such type of error occurred as below.

enter image description here

i tried to get the header information of that image as below..

 $headers = get_headers($external_image_url);

but the result was empty. how to solve this error? if this image can not be accessed then how to display an alternate "image imageNotFound.jpg" in it's place .

Sujan Shrestha
  • 612
  • 3
  • 13
  • 34

1 Answers1

1

try this code to check if the given image exists or not.

if(file_exists($external_image_url)) 
{
  $image_link = $external_image_url; //if that image exists
 }
 else
    {
      $image_link = "imageNotFount.jpg"; //if that image does not exists
    }