3 replies [Last post]
goodeit's picture
Offline
Joined: 05/28/2008
Juice: 322
Was this information Helpful?

When adding products to my website, I often use the same image for multiple (similar) items. That's OK, right? Well sure, except for the fact that I now have a list of images on the server that look like:

product1.jpg
product1_0.jpg
product1_1.jpg
product1_2.jpg
...

where everything after the first image is a bit-for-bit duplicate of the original. Is there a way to have Drupal automatically detect a duplicate image (same filename, same hash, ??) and link the new product to the old image instead of creating a duplicate? OR is there a way I can select an image currently residing on the server instead of uploading a new one for each product I create?

The closest I have gotten to this solution was on the initial import using node_import, where I could specify the same file name for multiple products and all nodes would use the same image file.

We are going on 2500+ images on the site (plus all of the copies imagecache makes) and it would be nice to get them somewhat cleaned up with all of the duplicates removed.

Also, as an aside, what is the easiest way to change filenames of certain images on the server and have drupal update that in the nodes (e.g. I would like to manually remove a space from some uploaded pictures without deleting/re-uploading it).

Thanks!

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Best Way to Handle Duplicate Images?

Not the answer you're looking for, I imagine, but this is essentially a known deficiency in the file system, at least as of D5. I'd be surprised if it were fixed by D6 but surprised if it isn't fixed by D7. You'll have to dig around d.o for more info.

goodeit's picture
Offline
Joined: 05/28/2008
Juice: 322
Re: Re: Best Way to Handle Duplicate Images?

ugh you're right that's not what I wanted to hear... but thanks anyways I will do some poking around later.

contractorexam's picture
Offline
Joined: 06/26/2010
Juice: 26
Re: Best Way to Handle Duplicate Images?

I didn't see an option show in my products settings until I added the "ImageCache" module. Is that the case with you?

I think the problem is with that module because the only option I see is to "upload" another file vs using an existing file.