magento2: Magento 2.3.4 couldn't get category image name

Preconditions (*)

  1. Magento 2.3.4

Steps to reproduce (*)

  1. Create a Category and add an image to that category.
  2. I need to display the category image of few categories based on id in homepage. So i have try to use the code in frontend as below,
$category->getImageUrl()

$category->getImage()
  1. But it returns the tmp path image of that category.
  2. I have even tried using the above codes for getting category image name in vendor/magento/module-catalog/view/frontend/templates/category/image.phtml but end up with getting wrong result.

Expected result (*)

  1. $category->getImageUrl() - It should return full path of category image(localhost/ver1/pub/media/catalog/category/imagename.jpg)

  2. $category->getImage()- It should return only the name of category image(imagename.jpg)

Actual result (*)

  1. Both the code returns temporary(tmp) path image of the category (/localhost/ver1/pub/media/catalog/tmp/category/imagename.jpg)

2.Couldn’t get the filename of the category image separately.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (12 by maintainers)

Most upvoted comments

Hi @engcom-Charlie, This is not a feature, but a bug. Production image shouldn’t be stored in temporary (tmp) folder, they have to be moved.