Link to home
Start Free TrialLog in
Avatar of movieprodw
movieprodw

asked on

replacing non existing images with images

Hello,

I am using google base to pull content and some of the content has image links that are broken, this is resulting in me having 100 images and 5 broken images on a page.

Is there any way to say .if image not found then display /no_image.jpg.?
ASKER CERTIFIED SOLUTION
Avatar of -pio-
-pio-
Flag of Hungary image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of movieprodw
movieprodw

ASKER

Those are both great ideas!

Is there a php way to do it?

here it the code,

<div class="image"><a href="listing.php?gid=<?=$aProperty[$j]["sId"]?>"><img src="<?php echo $aProperty[$j]["sImg"]; ?>" title="Real Estate, <?php echo $aProperty[$j]["sLocation"]; ?>" width="96" height="66" border="0" /></a></div>
Here it is.

<div class="image">
<a href="listing.php?gid=<?=$aProperty[$j]["sId"]?>">
<img src="<?php if (file_exists($aProperty[$j]["sImg"])) { echo $aProperty[$j]["sImg"]; } else { echo "images/nopicture.jpg"; } ?>" title="Real Estate, <?php echo $aProperty[$j]["sLocation"]; ?>" width="96" height="66" border="0" />
</a>
</div>

Open in new window

interestingly enough that replaced all of the images with my no image!

I think its because they are getting pulled from google and they are not being pulled from the server like a normal file?