Help Needed image file Problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tinkywonk
Forum Newbie
Posts: 2
Joined: Wed Feb 06, 2008 4:10 am

Help Needed image file Problem

Post by tinkywonk »

Hello can anyone help me I have been trying for days to basically check to see if an image file exists on a remote server and if it does not to show a default image but no matter what i try ie file_exists, fopen and so on none of them can return the correct value of yes or no. No one has been able to help me with this so if anyone has any ideas please let me know i have posted a little bit of code to show you where its need hopefully it will help

Code: Select all

<?PHP
$exists = false;
$url = "http://naturanauk.co.uk/photos/".str_replace("/","",htmlspecialchars($row["PROD/COL"])).".jpg";
 
 
if($exists){
?>
    <td class="<?php echo $style; ?>"><a href="<?php echo "http://naturanauk.co.uk/photos/".str_replace("/","",htmlspecialchars($row["PROD/COL"])).".jpg"; ?>"><img src="<?php echo "http://naturanauk.co.uk/photos/".str_replace("/","",htmlspecialchars($row["PROD/COL"])).".jpg"; ?>" height="50" width="50" border=0></a></td>
<?PHP
}
else {
?>
    <td class="<?php echo $style ?>"><img src="<?php echo "http://naturanauk.co.uk/photos/noimage.jpg"; ?>" height="50" width="50" border=0></td>
<?PHP
}
?> 
 
Post Reply