Forum Moderators: coopster

Message Too Old, No Replies

php script to determine if image loads.

         

dkin

5:27 pm on Jun 14, 2005 (gmt 0)

10+ Year Member



I have a database of links to images, I link to them like this

<a href="page.php'.$row['imagelink'].'">LINK</a>

now how can I determine if this image does not load correctly, if it doesnt load right it throws off all my tables so I would like to display a generic "Image not available" image in its place.

Thank you

mcibor

6:14 pm on Jun 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The only way I can think of now is to check if file exists:

if(file_exists($row['imagelink'])) $file = $row['imagelink']; else $file = "/img/empty.jpg";

<a href="page.php?img='.$file.'">LINK</a>

I don't quite follow why you have page.phpandhererowimagelink? does the variable hold?url=http...?

Best regards
Michal Cibor