Skip to content

Commit

Permalink
Fixed compatible 2.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
alothemes committed Feb 25, 2021
1 parent aa8b6da commit 7dab64a
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions Block/Categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,9 @@ public function getImageInfo($image)
public function getImageUrl($image)
{
if(is_object($image)) $image = $image->getImage();
$image = substr($image, strpos($image, "media/") + strlen('media/'));
if($image) {
if (substr($image, 0, 1) === '/') {
$url = $this->storeManager->getStore()->getBaseUrl(
\Magento\Framework\UrlInterface::URL_TYPE_WEB
) . ltrim($image, '/');
} else {
$url = $this->storeManager->getStore()->getBaseUrl(
\Magento\Framework\UrlInterface::URL_TYPE_MEDIA
) . 'catalog/category/' . $image;
}
$url = $this->storeManager->getStore()->getBaseUrl( \Magento\Framework\UrlInterface::URL_TYPE_MEDIA ) . $image;
} else {
$url = $this->viewAssetRepo->getUrl('Magento_Catalog::images/product/placeholder/small_image.jpg');
}
Expand Down

0 comments on commit 7dab64a

Please sign in to comment.