Skip to main content
deleted 29 characters in body
Source Link
temper
  • 1k
  • 12
  • 44

ToFirst try to get Category Image urlattribute :-

<?php$category_id echo= $category->getImageUrl20;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); ?>

And use it in <img> tag like

<img src="<?php $_category echo= $category$objectManager->getImageUrl>create('Magento\Catalog\Model\Category'); ?>" />

And get Alternate Image url:

echo $category->getImageUrl>load('category_alternate_image'$category_id); 
<img src="<?php  echo $category
print($_category->getImageUrl>getData('category_alternate_image''custom_attribute')); ?>" />

After this, use media class to show image.

To get Category Image url:

<?php echo $category->getImageUrl(); ?>

And use it in <img> tag like

<img src="<?php  echo $category->getImageUrl(); ?>" />

And get Alternate Image url:

echo $category->getImageUrl('category_alternate_image'); 
<img src="<?php  echo $category->getImageUrl('category_alternate_image'); ?>" />

First try to get attribute :-

$category_id = 20;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$_category = $objectManager->create('Magento\Catalog\Model\Category')->load($category_id);  
print($_category->getData('custom_attribute'));

After this, use media class to show image.

Source Link
temper
  • 1k
  • 12
  • 44

To get Category Image url:

<?php echo $category->getImageUrl(); ?>

And use it in <img> tag like

<img src="<?php  echo $category->getImageUrl(); ?>" />

And get Alternate Image url:

echo $category->getImageUrl('category_alternate_image'); 
<img src="<?php  echo $category->getImageUrl('category_alternate_image'); ?>" />