How product images are saved in database Magento 2?

A Product is the heart of any e-Commerce system, A product contains multiple information like Title, SKU, Price, Inventory, Images and so more details.

Let’s start with the Main point, A product has multiple images, and I will just explore how each product is stored in the database. Your confusion will be clear after reading the below details of the image saved in the database.

catalog_product_entity_varchar  used for store product image value.

One Reply to “How product images are saved in database Magento 2?”

  1. When I try to run “bin/magento catalog:images:resize’ I get en error like: “image a/b/abc.jpg does not exist”. looking at the mentioned tables I found records in this tables:

    catalog_product_entity_media_gallery
    catalog_product_entity_media_gallery_value
    catalog_product_entity_media_gallery_value_to_entity

    for images of products deleted long time ago and the images do no exist anymore in pub/media/catalog/product. How can I clean the mentioned tables?
    Maybe a MySQL query to delete from “catalog_product_entity_media_gallery” where “entity_id” not existing in “catalog_product_entity”. fox example.

Comments are closed.