Option to return img src with fullpath address

This commit is contained in:
Cauan Cabral 2012-01-17 22:55:24 -03:00
parent 339259c841
commit 0c0135ff5e
2 changed files with 9 additions and 0 deletions

View file

@ -351,6 +351,10 @@ class HtmlHelperTest extends CakeTestCase {
$result = $this->Html->image('/test/view/1.gif');
$this->assertTags($result, array('img' => array('src' => '/test/view/1.gif', 'alt' => '')));
$result = $this->Html->image('test.gif', array('fullPath' => true));
$here = $this->Html->url('/', true);
$this->assertTags($result, array('img' => array('src' => $here . 'img/test.gif', 'alt' => '')));
}
/**

View file

@ -706,6 +706,11 @@ class HtmlHelper extends AppHelper {
}
$path = $this->assetTimestamp($this->webroot($path));
}
if(!empty($options['fullPath'])) {
$path = $this->url('/', true) . $path;
unset($options['fullPath']);
}
if (!isset($options['alt'])) {
$options['alt'] = '';