Created
August 28, 2014 20:20
-
-
Save fadonascimento/6db321e76bdb051fa64d to your computer and use it in GitHub Desktop.
Verifica se existe a Imagem pelo HtmlHelper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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