abajja
(Abajjam)
1
I am trying to get file_exists() in this code working as expected but without success.
$filename = Yii::app()->request->baseUrl . '/images/thumbnails/'.$row['products_image'];
if (file_exists($filename)) {
echo '<img src="'.$filename.'" alt="imatge del producte...">';
} else {
echo "Imatge no disponible";
}
Any help. Thanks.
a.bajja
qiang
(Qiang Xue)
2
You can't do that because it is a URL.
coma
(Amtxxx)
4
and what would be the fix? I’m struggling here )
I’m trying to go as follows:
if (file_exists('/img/trololo.jpg')) { ... }
The img dir is in root dir of the project.
GDzyne
(Dieter)
5
Try this :
if (file_exists(YiiBase::getPathOfAlias('webroot').'/img/trololo.jpg')) { ... }