Hi There,
One of my affiliaes is returning images that say "404 Not Found"
{link saved}
Any idea how to return noimage.jpg on that result?
I am using
<div class="product-image">
<?php if ($mainProduct["image_url"]): ?>
<img src='<?php print $mainProduct["image_url"]; ?>' alt='<?php print $mainProduct["name"]; ?>' />
<?php else: ?>
<img src='<?php echo $config_baseHREF; ?>images/noimage.jpg' />
<?php endif; ?>
</div><!-- product-image -->
Thanks
Richard
Hi Richard,
Since there is no (efficient) way to tell that images are returning 404 at the time of page generation, the best solution in this case is to use the JavaScript onerror event of the associated IMG tag; so where you have:
<img src='<?php print $mainProduct["image_url"]; ?>'
...try something like:
<img onerror='JavaScript:this.src="/images/noimage.jpg";' src='<?php print $mainProduct["image_url"]; ?>'
I'm looking into your other query regarding limiting random Featured Products to no more than n from the same merchant - i'll follow up to that once I've done some experiments...
Cheers,
David.
--
PriceTapestry.com