This is an extensive patch that fundamentally changes the way ImageField works.
The current ImageField in Drupal 6 attempts to piggy-back off of FileField while providing its own CCK field type. This approach requires ImageField to implement hook_field() and several FileField custom hooks, many of which are buggy or not being used at all.
I've been fixing several issues in the FileField queue, such as broken revision handling (#370531: Properly Handle Revisions for document control) and duplicate uploads (#370015: Upload issue with clicking 'Add another item' multiple times (Repost w/ screencast)). However, these problems still exist in ImageField since it uses it's own hooks for managing its fields.
In short, we've got a lot of duplicated code between ImageField and FileField, and the code that is shared between the two is shared by mechanisms that CCK was not made to handle (i.e. it's all a bit of a hack to work around limitations in CCK).
So this patch removes the "Image" field type, and makes ImageField a pure widget for FileField. This means less code in ImageField, more reuse, and less bugs. The only side-effect of this is that all the formatters specific to ImageFields are also now available to FileFields. However, ImageCache already provides all its formatters to FileField anyway, so this isn't that big a shift.
This patch refactors ImageField to make it a pure widget. It also fixes the upgrade path between the Drupal 5 1.x version of ImageField and the current 3.x. This patch needs to be applied to both FileField and ImageField at the same time.
Comment | File | Size | Author |
---|---|---|---|
#2 | filefield_imagefield_untangle.patch | 36.24 KB | quicksketch |
#1 | filefield_imagefield_untangle.patch | 35.11 KB | quicksketch |
filefield_imagefield_untangle.patch | 37.04 KB | quicksketch |
Comments
Comment #1
quicksketchRevised patch with a few less code style fixes unrelated to the issue.
Comment #2
quicksketchUpdated patch that also regenerates thumbnails with a better path. This was suggested in http://drupal.org/node/385726#comment-1307422.
Comment #3
quicksketchThe upgrade path fix included in this patch also fixes #374764: Drupal 5 Update Breaks Titles and Alt text.
Comment #4
quicksketchAlso fixes #372239: Upgrade from ImageField 5.x-2.2 to 6.x-3.0-alpha4 Does not produce necessary thumbnail files.
Comment #5
quicksketchMan, also fixes #316099: Hard-coded file extensions "Must be a JPEG, PNG or GIF image".
Comment #6
quicksketchAnd #377148: problem after upgrading Drupal 5.15 to 6.9.
Comment #7
quicksketchConsidering the number of dependent issues on this one and my desire to get out a working upgrade path as soon as possible, I've committed this patch. At the very least it's going to fix more problems than it will cause.
Comment #8
RobLoachWow! Nicely done, Nate! Didn't even see this issue... ImageField code is good now!
Comment #9
drewish CreditAttribution: drewish commentedSaw one warning during the update:
Comment #10
Boletus CreditAttribution: Boletus commentedThis sounds great. Been waiting for the imagefield 6 forever. Good work! Will try to test this tomorrow. Can I use the dev version of ImageField and FileField and not patch anything, or what do you suggest?
Comment #11
quicksketchThanks drewish, I put an isset() check in there. This would have caused upgrading from ImageField d6 to this new version to lose any custom file paths specified.
Comment #12
himtuna CreditAttribution: himtuna commentedHi, I don't know how to apply a patch.
Please can someone give me a working file of imagefield.module
That would be really thankful.
EDIT:Please this is an emergency, I am building my site and everything seems to be broken, I someone could send me a working module of filefield and imagefield. Please please please.
Comment #13
quicksketchhimtuna: get the development versions which have all the patches applied. Visit the project page for ImageField and FileField, click "View all releases", then download the 3.x-dev versions.
Comment #14
himtuna CreditAttribution: himtuna commentedOh! Man thanks a lot
You know when you work hard all day long on our weekends, your head just don't work
Thanks a lot for this module.