Forum Moderators: coopster
<img src="<?php echo $data['thumbnailUrl'];?>" alt="" border="0" width="122" height="92">
<?php
$thumbImgUrl = $staticThumbUrl;
if (file_exists($data['thumbnailUrl'])) {
$thumbImgUrl = $data['thumbnailUrl'];
}
?>
<img src="<?php echo $thumbImgUrl;?>" alt="" border="0" width="122" height="92">
<img src="<?php if(is_file($data['thumbnailUrl'])){
<img src="<?php echo $data['thumbnailUrl'];?>" alt="" border="0" width="122" height="92"></a>
}else{
<img src="noimage.jpg" width="168" height="128" alt="" /></a>
}
?>" alt="" border="0" width="122" height="92"></a>
This function will return FALSE for symlinks pointing to non-existing files.
it does not work
The results of this function are cached.
<img src="<?php if(is_file($data['thumbnailUrl'])){
<img src="<?php echo $data['thumbnailUrl'];?>" alt="" ....
$data['thumbnailUrl'] is presumably a client-side URL and is_file() (or file_exists()) check a server-side filesystem path - so this is unlikely to be successful. Maybe you already have the filesystem path in your $data array? If not, you'll need to construct this from the URL. <img src="<?=$data['thumbnailUrl']?>" onerror="this.src='/images/image-does-not-exist.png'" alt="">