Permalink
Browse files

Option to return img src with fullpath address

  • Loading branch information...
1 parent 339259c commit 0c0135ff5e24ecf52805afa6a9d82964bd4b2291 @CauanCabral CauanCabral committed Jan 18, 2012
Showing with 9 additions and 0 deletions.
  1. +4 −0 lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
  2. +5 −0 lib/Cake/View/Helper/HtmlHelper.php
@@ -351,6 +351,10 @@ public function testImageTag() {
$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' => '')));
}
/**
@@ -706,6 +706,11 @@ public function image($path, $options = array()) {
}
$path = $this->assetTimestamp($this->webroot($path));
}
+
+ if(!empty($options['fullPath'])) {
+ $path = $this->url('/', true) . $path;
+ unset($options['fullPath']);
+ }
if (!isset($options['alt'])) {
$options['alt'] = '';

0 comments on commit 0c0135f

Please sign in to comment.