diff --git a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
index e98c15605..6d0c31cb0 100644
--- a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
@@ -315,18 +315,19 @@ class HtmlHelperTest extends CakeTestCase {
Configure::write('Asset.timestamp', 'force');
- $result = $this->Html->link($this->Html->image('../favicon.ico'), '#', array('escape' => false));
+ $result = $this->Html->link($this->Html->image('../favicon.ico'), '#', array('escape' => false));
$expected = array(
'a' => array('href' => '#'),
- 'img' => array('src' => 'preg:/img\/..\/favicon\.ico\?\d*/', 'alt' => ''),
+ 'img' => array('src' => 'img/../favicon.ico', 'alt' => ''),
'/a'
);
$this->assertTags($result, $expected);
$result = $this->Html->image('../favicon.ico', array('url' => '#'));
+
$expected = array(
'a' => array('href' => '#'),
- 'img' => array('src' => 'preg:/img\/..\/favicon\.ico\?\d*/', 'alt' => ''),
+ 'img' => array('src' => 'img/../favicon.ico', 'alt' => ''),
'/a'
);
$this->assertTags($result, $expected);
@@ -351,6 +352,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('fullBase' => true));
+ $here = $this->Html->url('/', true);
+ $this->assertTags($result, array('img' => array('src' => $here . 'img/test.gif', 'alt' => '')));
}
/**
diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php
index 29fb49790..7a1943aae 100644
--- a/lib/Cake/View/Helper/HtmlHelper.php
+++ b/lib/Cake/View/Helper/HtmlHelper.php
@@ -739,8 +739,9 @@ class HtmlHelper extends AppHelper {
/**
* Creates a formatted IMG element. If `$options['url']` is provided, an image link will be
- * generated with the link pointed at `$options['url']`. This method will set an empty
- * alt attribute if one is not supplied.
+ * generated with the link pointed at `$options['url']`. If `$options['fullBase']` is provided,
+ * the src attribute will receive full address (non-relative url) of the image file.
+ * This method will set an empty alt attribute if one is not supplied.
*
* ### Usage
*
@@ -766,6 +767,11 @@ class HtmlHelper extends AppHelper {
}
$path = $this->assetTimestamp($this->webroot($path));
}
+
+ if (!empty($options['fullBase'])) {
+ $path = $this->url('/', true) . $path;
+ unset($options['fullBase']);
+ }
if (!isset($options['alt'])) {
$options['alt'] = '';