Skip to content

Instantly share code, notes, and snippets.

@gabrielem
Created October 10, 2014 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielem/aa60c74b9688a06924cc to your computer and use it in GitHub Desktop.
Save gabrielem/aa60c74b9688a06924cc to your computer and use it in GitHub Desktop.
Add Extension if not ;)
//Gabriele - Adding Global Function for correct Images Visibility
function getFullImageUrlForPopUp($path)
{
/*
* This is a bug fix
* as some of the images
* uploaded in this sitem
* was cutting the extension name
* like some .jpeg images are display
* in the source field without extension
* causing error with javascript popup
*/
//$this->webroot
///web/htdocs/www.romasiteweb.it/home/lombardi/app/webroot/img/images/large/38_Element_ciampino_ciampino_28072014-130833
$ext_array=array('.jpeg','.jpg','.png','.gif');
//print_r(APP."webroot/".$path);
if(!file_exists(APP."webroot/".$path)){
foreach ($ext_array AS $ext){
if(file_exists(APP."webroot/".$path.$ext))
return $path.$ext;
}
}else
return $path;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment