Jump to content

[SOLVED] Display an ALT tag when an image is missing...


JTapp

Recommended Posts

I'm no expert (just waiting for my question to be answered, but...

 

$imagelink = $imagesFolder.$row['CompanyID'];

if (file_exists($imagelink)) {
echo "<img src='".$imagelink.".jpg' /></p>";
} else {
echo "<img src='".$imagelink.".jpg' alt='The image is not available' /></p>";
}

 

should work?

<?php
$imagefile = "$imagesFolder{$row['CompanyID']}.jpg";
if (file_exists($imagefile))
echo "<img src='$imagefile' />";
else
    echo "<img src='default.jpg' alt='The image is not available'/>";
?>

Well, how about just this? (unless I didn't read the thread properly and it has to be an alt tag)

 

<?php
$imagefile = "$imagesFolder{$row['CompanyID']}.jpg";
if (file_exists($imagefile))
echo "<img src='$imagefile' />";
else
    echo "The image is not available";
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.