Skip to content

Commit 73829f4

Browse files
committed
MAGETWO-64587: getRelativePath issue in \Magento\Catalog\Model\View\Asset\Image
1 parent 0328a45 commit 73829f4

File tree

1 file changed

+16
-1
lines changed
  • app/code/Magento/Catalog/Model/View/Asset

1 file changed

+16
-1
lines changed

app/code/Magento/Catalog/Model/View/Asset/Image.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function getContentType()
9595
*/
9696
public function getPath()
9797
{
98-
return $this->getRelativePath($this->context->getPath());
98+
return $this->getAbsolutePath($this->context->getPath());
9999
}
100100

101101
/**
@@ -175,6 +175,21 @@ private function getMiscPath()
175175
return $this->encryptor->hash(implode('_', $this->miscParams), Encryptor::HASH_VERSION_MD5);
176176
}
177177

178+
/**
179+
* Generate absolute path
180+
*
181+
* @param string $result
182+
* @return string
183+
*/
184+
private function getAbsolutePath($result)
185+
{
186+
$prefix = (substr($result, 0, 1) == DIRECTORY_SEPARATOR) ? DIRECTORY_SEPARATOR : '';
187+
$result = $this->join($result, $this->getModule());
188+
$result = $this->join($result, $this->getMiscPath());
189+
$result = $this->join($result, $this->getFilePath());
190+
return $prefix . $result;
191+
}
192+
178193
/**
179194
* Generate relative path
180195
*

0 commit comments

Comments
 (0)