The behaviour appears to be when the image filename contains a special character, for example, _ or -. This is a very common use case as often, images provided by suppliers and manufacturers have filenames that are the same as the product SKU. We've reached out to the Shopify dev team but no solution thus far.
Has anyone else run into this and figured out a workaround? Shopify support, we'd appreciate a response too if you have the solution. This started happening about 4-6 weeks ago so it looks like there was a change on your side.
1. Importing images via API
2. If image filename contains a special character, a duplicate image is added to the product
Just ran into this myself, and I can't even tell what teh exact fauty behavior is, but it seems to be beyond just special chars, such as "_" or "-".
I have 9 images for a product, named "product-image-1.jpg, product-image-2.jpg, ..." etc.
When I open a brand new, clean store, with nothing uploaded or download or installed to it, and I ush this product to Shopify via API, it uploads the first 5-6 images appropariately, as they are named, "product-image-1.jpg, product-image-2.jpg, product-image-3.jpg, product-image-4.jpg, product-image-5.jpg."
But then the next 4 it uploads as something like "product-image-6_isduhf-987sdf-sudhf89-8sydgf.jpg" ...
I can't figure out what it is, and all I've found so far is threads that say this is done when there is a duplicate named image. But there are no duplicate images on the new store. And none of the images are duplicate names on the original store, from which I'm pushing/pulling products, as I checked, and if there were, they would already have been renamed by Shopify on the original store anyway.
I discover this when I go to use the API AFTER already uploading the images, to assosciate them with their variants on the new store.
To do that I use a "map" of old store images VS SKUs, but when I go to upload them, the image filenames have been changed from the original name on the old store, to a new name, as if there were already duplicate images with the same names on the new store.
I was also having this problem this morning, and not because of a duplicate file... could not figure it out. Came here looking for help and didn't find a solution that worked, so I wanted to circle back and say what did work for me.
Not sure what made me try this, but I added a single underscore to the end of my filename and Shopify renamed to the filename I was trying to get when it was ingested. (insert shrug emoji)...
For reference, I was trying something like: tag__product_Small.jpg and when I uploaded it, it would look like tag__product_Small-ahagihw-ainew2840-gh2hi23.jpg
When I uploaded tag__product_Small_.jpg the file was ingested as tag__product_Small.jpg
Doesn't solve it, but might provide the Shopify devs with good intel, and might be a workaround for you. Good luck!