if an image has the Exclude
checkbox checked, it will not appear in the product view page in the media gallery images. (small thumbnails).
But it can still be the base image or small image or thumbnail.
It is very useful when you don't want image duplicates.
So you should check the Exclude
checkbox for the image you set as base image.
I know its not the best way to update the database directly, but in this case it might be the fastest way to set all default images to exclude so that you don't need a template hack.
With the following query you will set the base image (attribute image) to exclude (disable=1) in the media gallery:
UPDATE catalog_product_entity_media_gallery_value AS mgv
INNER JOIN catalog_product_entity_media_gallery AS mg ON mgv.value_id=mg.value_id
INNER JOIN catalog_product_entity_varchar AS cpev ON mg.entity_id=cpev.entity_id AND cpev.value=mg.value
INNER JOIN eav_attribute AS ea ON ea.attribute_id=cpev.attribute_id
SET mgv.disabled=1
WHERE ea.attribute_code='image'
Before running the query make sure you have a backup (and test it on your staging/test setup first). Also don't forget to add the table prefix if you are using that. I tested it on the Magento 1.9 sample data and it looks like it works.
Best Answer
I had the same issue. I managed to exclude the images by removing them using the same code but with a small change. Before doing any of the following, BACKUP your database.
Change this
To this
It will remove the image from displaying in admin, but the actual image will remain under media folder.
Regards, Daniel