magento2: Magento 2.3.4 couldn't get category image name
Preconditions (*)
- Magento 2.3.4
Steps to reproduce (*)
- Create a Category and add an image to that category.
- 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()
- But it returns the tmp path image of that category.
- 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 (*)
-
$category->getImageUrl() - It should return full path of category image(localhost/ver1/pub/media/catalog/category/imagename.jpg)
-
$category->getImage()- It should return only the name of category image(imagename.jpg)
Actual result (*)
- 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)
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.