I have 3 different content types with imagefields, but only one of them uses the imagefield_crop_widget. However, whenever users upload images to the 2 other content-types, a duplicate image with the 'crop_display.jpg' suffix is created.
The two content types not using the imagefield_crop widget are both using the imagefield_widget, but do use imagecache for displaying the images.
At one point in the past, one the content types had both a standard imagefield and and an imagefield_crop image attached, but the crop field was later removed. I wondered whether some trace of this extra field remained and was causing the duplicate images to be created, but I'm seeing the same behaviour with the 3rd content-type which only has an imagefield, and was created after the imagefield_crop module was installed.
I'm not really sure if this is a bug report, or a feature request. Is there a reason that the duplicate image is required? If not, I would prefer that they weren't created, as they are rapidly bloating the files directory. Please let me know if any extra info is required - thanks.
Comments
Comment #1
yhager commentedThank you for the report. This indeed sounds like a bug, duplicate images should not be created when they are not needed.
I'll work on it (it just wouldn't be so prompt as I like it to be). Thank you for your patience!
Comment #2
matkeane commentedWell, if the fix is as rapid as your response to a new issue, that would be great! ;-)
I'm seeing the same behaviour on my dev server as well as the live site (If I get a moment, I'll try a clean install and see what happens). To be clear about the content types and their creation:
- Content-type 1 added with imagefield
- Imagefield_crop module added and extra field added to content-type 1
- Client changes their mind about cropping, so field removed
- Content type 2 added with imagefield_cropping (and working fine)
- Content type 3 added with imagefield but without cropping
All 3 show the same behaviour of duplicating uploaded files.
Module versions are:
cck - 6.x-2.2
filefield - 6.x-3.0-rc1
imagefield - 6.x-3.0-rc1
imagefield_crop 6.x-1.0-beta3
imagecache - 6.x-2.0-beta8
ImageAPI - 6.x-1.6
Transliteration - 6.x-2.0
File system download method is set to public.
There are other modules in use, but these are the ones related to file and image handling.
Anyway, thanks for your help. I hesitated before filing the bug report, as it seemed a bit mean to complain about such a great module!
[Update] I just recreated the issue on a new, blank, site:
- Activated CCK, ImageAPI, Filefield, ImageField and Imagefield Crop (but not Imagecache),
- Added an imagefield (no cropping) field to a new content-type,
- Uploaded test image, and the image was duplicated with the 'crop_display.jpg' suffix.
Hope that helps...
Comment #3
decipheredIssue and fix are both quite simple.
Issue is that hook_file_insert() is called by and FileField widget and therefore imagefield_crop_file_insert() is being called on all FileField widgets. Currently, as long as long as the $file is an image the 'crop_display.jpg' file will be created.
Fix, change line 9 of imagefield_crop_file.inc from:
To:
Cheers,
Deciphered.
Comment #4
yhager commentedThanks! committed.
Comment #5
matkeane commentedHi,
Just tried this out and it seems to be working fine - thanks for the fix!
Comment #7
yakker commentedNot to be a pain by reopening this, but I no longer have Imagefield Crop enabled (or even in my modules), yet I'm still generating the cropped image duplicates... Any ideas?Sorry - all good!