Getting Rid Of Duplicate Images

There seem to be problems with the last 4.2 upgrade, at least we have encountered some. I have found that many of our products have duplicate images. The problem is not physical duplicates but multiple product images linking to one physical image. Does this seem to indicate database damage? If image import is working correctly I can export all, and reimport after de-duping. How to delete the extra product images? Would this have to be done directly to the database? Thanks for any insights.

Can you describe what you mean more precisely by duplicate images?

It sounds like you're describing multiple products pointing to the same physical image on disk. Sorry, but not clear what problem exists.

Thanks for reply. Example: One product has 8 images pointing to four physical images on disk. The first two images point to the main image, second two to the first additional image, and so forth. Not all products exhibit this, some showing no duplicate images.



I exported images for selected products containing duplicate images, which contain duplicate rows corresponding to the duplicate images. I manually deleted some of the dupe images from a product; the CSV export showed the correction. Products with no image (one or two are missing until I get images) just export one row with Pair type “M”, a null value (“”) for Detailed image and Position “0”.



It would seem that duplicate rows shouldn't be allowed to be added. One would think that if two rows had the same Product code and Position only the first one would be added during an import and the second would simply overwrite the first, possibly with a different file path. If this is the case then I think the presence of dupes must be due to damage to the database file or perhaps they are artifacts of the upgrade process (we just upgraded from 4.0.1 to 4.2 which uses a different directory for images) and not the result of any import. The duplicate rows do have the correct file path.



I'm wondering if I can export images for all products, de-dupe the rows and re-import. It seems as if I might need to completely delete the images from the database before re-importing, which I guess would mean working with the db directly, unless there is some way to clear or delete the image records with an import.

Could be the upgrade process. If you used standard cs-cart upgrade process then report it as a problem through helpdesk and have them fix the problem they created. However, if you've done some manual fidgeting and/or have done import images after upgrading then it might be difficult for you to convince them that it is a problem they have created (and it may well not be).

[quote name='tbirnseth' timestamp='1425081298' post='206645']

Could be the upgrade process. If you used standard cs-cart upgrade process then report it as a problem through helpdesk and have them fix the problem they created. However, if you've done some manual fidgeting and/or have done import images after upgrading then it might be difficult for you to convince them that it is a problem they have created (and it may well not be).

[/quote]



Thanks for reply, Tony. Kind of what I thought. I didn't do the upgrade myself but I'm sure it was by the book. I already have a ticket in with them on a different image problem which I suspect is also upgrade related. I'll submit this one as well. I did attempt some imports before I noticed the double image problem and afterwards deleted a few of the imported images manually. Nothing outside of the web interface. Prior to the upgrade we had problems but fixed them. They came back and AFAIK this was cause by the upgrade.

The recent addition we made to our EZ Admin Helper tools will review images for being the correct sizing based on the DB (or adjust the DB to match the images). It will also remove any DB entries for objects (products) that don't exist. But unfortunately, it doesn't try to detect duplicate usage. It would be a lot of work to do that correctly.