如果图像存在显示其他隐藏它

I have the following situation.

If there isn't an image in the DB, the page it's on shows a big image placeholder. What is the best way to hide the image placeholder if an image doesn't exist?

<img src="<?php echo '../img/artists/' . $row_rsAccents['artistPhoto']; ?>" width="100%"/>

http://westerndesignconference.com/intheloop/

You can do this with a simple if/else statement like so:

//I prefer to set things with variables
$placeholder_img = "../img/artists/placeholder.jpg";
$db_img = $row_rsAccents['artistPhoto'];

if($db_img){
    $img_src = $db_img;
} else {
    $img_src = $placeholder_img;
}

echo "<img src='$img_src' alt='' width='100%' />";

If there is a value returned - show an image. If the condition fails, no <img> will be displayed, preventing the blank gap

if (isset($row_rsAccents['artistPhoto'])) {
    echo '<img src="../img/artists/' . $row_rsAccents['artistPhoto'] . '" width="100%"/>'
}
if (file_exists('artist.jpg') {
    echo "<img src='artist.jpg'>";
}
else {
    echo "<img src='default.jpg'>";
}