Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When using imagecache presets that are defined in code (e.g. as exportables), they do not have a preset id in the database and/or may have a different one than what the imagecache profile variables were saved as.
This patch allows imagecache presets to be referenced by name in the variables allowing them to, for example, be usable after export by Features and Strongarm. If the variable is numeric, will fall back to loading by preset id.
Patched against DRUPAL-6--1.
Comment | File | Size | Author |
---|---|---|---|
imagecache_profiles_preset_by_name.patch | 2.38 KB | yhahn |
Comments
Comment #1
andypostThis is a duplicate of #654566: Store Imagecache preset name rather than numeric ID
Please re-open if this change is really needed I can rollback #349331: Views 2 Support in 6.x + optimizations to storing preset-name, but it require downgrade-path
Comment #2
yhahn CreditAttribution: yhahn commentedPlease read my comment and the patch itself. You will see that the Views patch does not need to be rolled back, nor would a downgrade/upgrade path be required as the patch allows you to refer to imagecache preset by either name or by preset ID. This will allow existing installs to continue using their current settings without problem.
I have read your comments in #654566: Store Imagecache preset name rather than numeric ID and while you are correct that imagecache presets that are stored in the database can have their preset name changed, this is not true of imagecache exported presets. Moreover, the design of imagecache implies the preset name is the canonical id of an imagecache preset, given that it is the actual reference point in the URL external to the Drupal system. In other words, if imagecache truly meant for the preset ID to be the primary identifier for an imagecache preset, you would use a URL like
rather than
Given that changing the name of a preset also breaks all past URLs generated using it, it's neither an advisable operation nor an actually trivial "renaming."
Comment #3
andypostI agree with you, but checking
is_numeric($size)
is not good because users can give a numeric names to there presets alsois_int()
doesn't work because form results return strings.So we need to unify both settings to preset_name which is hard for existing views or hope that no one used numeric names for presets...
Comment #4
yhahn CreditAttribution: yhahn commentedI personally would go with the latter ("hope that no one used numeric names for presets") and see what kind of reports come back from users. I would consider this a reasonable limitation until you start a new branch of the project and can consolidate settings.
Comment #5
andypostSo let's get reviews on that and #719632: Views 3 compability
Then I plan new release
Comment #6
andypostCommited into RC1
Comment #7
DamienMcKennaOut of interest, would it be too much to request that Imagecache be changed to disallow numerical profile names?
Comment #8
andypostSeems reasonable but now imagecache in core...