How to show static image when there is no dynamic image

Hello, I have a script that shows dynamic images. When there is no image - $data[‘thumbnailUrl’], broken image box is displayed.

In order to fix that I put this code

[php]<?php if(is_file($data['thumbnailUrl'])){ ?>

<?php }else{ ?>
<img src="noimage.jpg" width="168" height="128" alt="" />
<?php } ?>[/php]

However now all images show noimage.jpg, instead of dynamic images wherever possible and static if no dynamic. What is wrong in my code? thanks!

[php]<?php

//No Image
$data[‘thumbnailUrl’] = ‘’;

// With image
//$data[‘thumbnailUrl’] = ‘http://www.thumbshots.com/Portals/0/Images/Feature%20TS%201.jpg’;

if ($data[‘thumbnailUrl’])
{
echo “<img src=”{$data[‘thumbnailUrl’]}" alt="" border=“0” width=“122” height=“92”>";
}
else
{
echo “<img src=“https://gazillionfund.com/wp-content/themes/twentytwelve/images/no-image.jpg” width=“168” height=“128” alt=”" />";
}
?>[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service