I'm using Yii 1.1.15 and am trying to use a simple file_exists() php function. But i cant get it to work.
when i just return the image url, the image shows. but when i use file_exists() it returns $img2
function in my model
public function brandPageImage($make = false) { $urlstr = Yii::app()->request->baseUrl.'/images/brand-pages/make/'; $img = $urlstr.trim(strtolower($make)).'-976x365.jpg'; $img2 = $urlstr.'default-976x365.jpg'; clearstatcache(); if (file_exists($img)) return $img; return $img2; } if i return $img directly it works!
public function brandPageImage($make = false) { $urlstr = Yii::app()->request->baseUrl.'/images/brand-pages/make/'; return $img = $urlstr.trim(strtolower($make)).'-976x365.jpg'; } this is the url it generates
/dev/frontend/www/images/brand-pages/make/lol-976x365.jpg
can someone help me, don't see what i'm doing wrong here. I'm running XAMMP on OSX Thanks
/dev? Sure? This is the *nix devices subsystem. It would be very weird to have JPEGs stored there.$imgon line 3, the image shows.$imgstring? In an<img>tag?