I was browsing through the DB, trying to find out where the media attributes of product-media-gallery-items are stored. For clarification: They are called "Roles" in the Admin-Frontend and "mediaAttributes" when interacting with them in Code.

There is the catalog_product_entity_media_gallery table that holds all pictures and then there is the catalog_product_entity_media_gallery_value table that holds information about the pictures, such as in which store-views they are placed and their position, but I wasn't able to figure out where those "Roles" are kept.

1 Answer 1


The 'roles' are specific attributes: image (for Base role), small_image (for Small), swatch_image (for Swatch) and thumbnail.

You can find the IDs of these attributes by checking the eav_attribute table and according to their backend_type, you will find the values associated per product in the catalog_product_entity_varchar table. The records will look like this:

enter image description here

  • Thank you once again for a great answer!
    – Hurrpadurr
    May 20, 2021 at 11:27
  • You are most welcome :) cheers!
    – Diana
    May 20, 2021 at 11:28

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.