Created
September 17, 2015 17:17
-
-
Save maximishchenko/f7138dfb6fe9132692f9 to your computer and use it in GitHub Desktop.
Yii if image exist show image else show nophoto.png
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo !empty($model-><field>) && file_exists(Yii::getPathOfAlias('webroot.images')."<PATH>".$model-><field>) ? CHtml::image(Yii::app()->baseurl."<PATH>".$model-><field>,"",array("style"=>"width:50px;height:50px;align:center;")) : CHtml::image(Yii::app()->baseurl."/<PATH>/no_img.png","",array("style"=>"width:50px;height:50px;align:center;")); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment