2

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(
    'input'=>'image',
    'type'=>'varchar',
    'label'=>'Gallery Main Image',
    'required'=>false,
    'visible'=>true,
    'user_defined'=>true,
    '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

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

1 Answer 1

0

Change permission to your media/category to 755.

or

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

4
  • 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
    Commented Dec 19, 2014 at 6:06
  • oh ok sorry i misunderstood, i'll come up with solution. Commented Dec 19, 2014 at 6:08
  • check the url in backend it tries to fetch.and post it. Commented 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. Commented Nov 17, 2015 at 6:09

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.