Add new image type for product in Magento

The goal of this article is to show to add new image type to product in Magento.

By default Magento has 3 type of images:

  1. Base image
  2. Small image
  3. Thumbnail image

Typically these types of images is sufficient. But sometimes it becomes necessary to add a new type of image. Add a new type of image is easy as Magento in the gallery displays all the attributes for which the attribute ‘input_type’ equals ‘media_image’.

Code, described below adds a new type of image «small_image_two». It should be executed as an SQL update.

$installer = $this;
    array (
        'group'             => 'Images',
        'type'              => 'varchar',
        'frontend'          => 'catalog/product_attribute_frontend_image',
        'label'             => 'Small Image Two',
        'input'             => 'media_image',
        'class'             => '',
        'source'            => '',
        'global'            => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
        'visible'           => true,
        'required'          => false,
        'user_defined'      => false,
        'default'           => '',
        'searchable'        => false,
        'filterable'        => false,
        'comparable'        => false,
        'visible_on_front'  => false,
        'unique'            => false,

After adding the attribute you will see the following:

New image type for product in Magento


  • admin |

    hello, t0th
    You should execute it in sql update script. Please, see as example any file in the folder: /app/code/core/Mage/Catalog/sql/catalog_setup

  • Josh |

    having a hard time getting this. how do I actually run the script? it looks like it runs when Mage_catalog is updated but how to I do that. I tried running ./pear intall Mage_Catalog and ./pear upgrade Mage_Catalog Any help would be appreciated.


  • Ciantic |

    I need to know how to execute the update SQL script?

    I agree with others, the instructions are lacking.

    I get it that files in /app/code/core/Mage/Catalog/sql/catalog_setup/ are in same format but it does not help newbie.

    If I create own file to that directory and throw the code above to there it does not magically get executed, I need to know how to execute the update SQL?

    Btw if it is just SQL why not paste SQL statements those are simple to execute with phpmyadmin…


    How to i start the “Magento update script”?


    How do i start the “Magento update script”?


    the best way is too reinstall magento.
    Put the new code in
    app\code\core\Mage\Resource\Eav\Mysql4\Setup.php line: 888

  • Felipe Leusin |


    I got this working by creating a custom module. Adding this to my custom module setup.

    My config.xml looked like:




  • Edward |

    Great, exactly what I was looking for, although a companion post on where to put the code might be helpful to all the commenters above!

  • Chintan |

    Will this work on adding new Image to the category?

  • subh |

    I have added a new image type. Now how can i access this new image in frontend?

    $this->helper(‘catalog/image’)->init($_product, ‘new-image-type’)->resize(177, 250) didnt help for me.

    please help!!!

  • Pushpendra |

    I want to add image in others tab how it possible ?
    like i have add new attribute like bag image but i don’ t want to show this attribute in image tab i want to show this attribute in my custom tab

So, what do you think ?