I am pulling posts from a database and want to display a default image if no image are available for a certain post. This is my current code:
<img alt="" src="<?php echo Yii::app()->baseUrl; ?>/uploads/classifieds/<?php echo ClassifiedImages::getTitleImage ($data->id)->filename; ?>" width="112" height="83" />
Any help will be greatly appreciated!
If I understand you, instead of
write
If the filename is empty, it will be replaced with “no-picture.jpg”.
You can also use jQuery if you know that.