I've created a custom image attribute for the category. The image will be saved in media/catalog/category/example location.

When I upload the image, preview showing as a broken image even though image exists in that location.

$installer->addAttribute($entity, 'g_main_image', array(
    'label'=>'Gallery Main Image',
    'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,

Image preview showing http://localhost/dev/media/catalog/category/audi.jpg but the actual image is in

  • check the image url in backend that tried to preview.and update with your question. Dec 19, 2014 at 6:09
  • Added the url for reference.
    – blakcaps
    Dec 19, 2014 at 6:28
  • why dont you use magento category image attribute? Dec 19, 2014 at 6:38
  • I am using category image for other purposes.
    – blakcaps
    Dec 19, 2014 at 6:56
  • just post the code you used for category image saving. Dec 19, 2014 at 7:05

1 Answer 1


Change permission to your media/category to 755.


You are saving the image to a directory and not correctly reference it in the table, so check your custom attribute value.

  • How changing file permission would help?Image is displaying correctly on the frontend. Only image preview in the backend is not working.I suppose this is something to do with the code.
    – blakcaps
    Dec 19, 2014 at 6:06
  • oh ok sorry i misunderstood, i'll come up with solution. Dec 19, 2014 at 6:08
  • check the url in backend it tries to fetch.and post it. Dec 19, 2014 at 6:08
  • save image value in db like gallery/{imagename.jpg} and check.plz add gallery before imagename in db table before save. Nov 17, 2015 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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