somebody knows why this script not working?
$imgname = get_stylesheet_directory_uri().'/images/headers/'.str_replace(' ', '', strtolower(get_the_title())).'.jpg';
if (file_exists($imgname)) {
echo '<img src="'.$imgname.'"> </img>';
} else {
echo '<img src="'.get_stylesheet_directory_uri().'/images/headers/default.jpg"> </img>';
}
it returns allways the default.jpg, even if the file exists I checked the $imgname, and it is ok