I've got a page that loads up images from a db for some houses. Say one house is called "A" I have some code that works like this:
echo "<img src='images/A_1.jpg' />";
echo "<img src='images/A_2.jpg' />";
echo "<img src='images/A_3.jpg' />";
etc etc until
echo "<img src='images/A_10.jpg' />";
Works fine for houses that have 10 images, but some of my houses only have 3 or 4 pictures meaning my page will attempt to load pictures that aren't there, no big deal in Firefox but in IE an ugly red cross shows up on the page.
Is there anyway to test if an image is present? something like "empty()" so i can add some if statements to the image placement code.
Only work around i can think of is counting the number of images for each house then entering that value in an extra field in the db, It would work ok but be a bit of a pain in the ass to do. Hoping there's a better way of doing it 😉