Forum Moderators: coopster

Message Too Old, No Replies

Detecting dead images

         

hswaseer

11:25 am on Jul 26, 2005 (gmt 0)

10+ Year Member



Hi,

My database contains the images of other sites.... when other sites remove some images from their websites, my side shows blank images as i am using their images and the same_path of their images.

1) Is there a way i can detect the blank images.

2) Is it possbile that the desciption of that image will appear only when that image is opened.

Regards

HS

dreamcatcher

3:12 pm on Jul 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried file_exists()

[uk2.php.net...]

dc

hswaseer

6:02 am on Jul 27, 2005 (gmt 0)

10+ Year Member



hi,

Yes, i have tried the file_exists function but it is not working

HS

hughie

8:13 am on Jul 27, 2005 (gmt 0)

10+ Year Member



you could try getimagesize()

e.g.

$imgsize=getimagesize($thepicture);
if ($imgsize[0]>0)
{
// show image
}
else
{
// dont show image
}

ta,
hughie

hswaseer

11:38 am on Jul 27, 2005 (gmt 0)

10+ Year Member



Hi hughie

I have tried your trick ...and it seems to be working....but there is one problem...when
'getimagesize' finds an image of '0' size it produces and error report which is

[function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Object Not Found.

So how should i get rid of this error

HS

hughie

1:54 pm on Jul 27, 2005 (gmt 0)

10+ Year Member



if its giving a fatal error then i'm not sure but it should be just a warning, if it is, you can put an @ in front of the function to supress the error

e.g.

$imgsize=@getimagesize($thepicture);

Cheers,
hughie