I'm trying to add a new custom image attribute for category, following the guide here "https://webkul.com/blog/add-custom-image-attribute-category-magento-2/comment-page-1/#comment-16835"

However, after I added these files under /app/code/[vendor]/[Module]/

Then run

php bin/magento setup:di:compile  
php bin/magento setup:upgrade  
php bin/magento c:c c:f

but nothing shows up, and I cannot find the module on the list. Please help

  • you forgot to run php bin/magento s:s:d Commented Feb 8, 2019 at 21:53
  • I tried to run that, but it's still not showing. also, can not find the module from the list "php bin/magento module:status" Commented Feb 8, 2019 at 22:34
  • you have to register your own module first
    – fmsthird
    Commented Feb 8, 2019 at 22:44

1 Answer 1


You can create your own custom module wherein you can use the resources from the guide provided in a link included in your post.

Follow the steps below




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Vendor_CustomModule" setup_version="1.0.0" />
  • 1
    This works, thanks a lot. After created the registration.php file, I had to delete the Vendor/Module/di.xml from the guide which was causing error, and replace the module.xml you provided. After that, just run setup:upgrade, and everything works now! Thanks, i'm new to creating modules. Commented Feb 8, 2019 at 23:15
  • Can you show me how to call the image in the front end? Commented Feb 8, 2019 at 23:52
  • it's on the comment: Please follow below steps in order to get image url at frontend. create instance of class Magento\Catalog\Model\CategoryRepository then get category model by calling get method like $category = $categoryRepository->get($categoryId, $storeId); $imageUrl = “magento_media_url_path”.”catalog/category/”.$category->getCustomImage(); And then you can use this $imageUrl in your custom category page or as per your design.
    – fmsthird
    Commented Feb 9, 2019 at 2:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.