Magento – Custom Category Image Attribute Preview

category-attributeimage-previewmagento-1.9

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

Best Answer

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.

Related Topic