Skip to content

Instantly share code, notes, and snippets.

@fadonascimento
Created August 28, 2014 20:20
Show Gist options
  • Save fadonascimento/6db321e76bdb051fa64d to your computer and use it in GitHub Desktop.
Save fadonascimento/6db321e76bdb051fa64d to your computer and use it in GitHub Desktop.
Verifica se existe a Imagem pelo HtmlHelper
/**
* Verificar se a imagem existi
* caso ela exista retorna para o helper do html
* se ela não existir retorna false para não exibir a div sem imagem
*
*/
public function image($path, $options = array())
{
$realPatch = ROOT . DS . APP_DIR . DS . WEBROOT_DIR . 'img' . DS . join(DS,explode('/',$path));
if (!is_file($realPatch)) {
return false;
}
return parent::image($path,$options);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment