Since Imagecache Presets can be defined in code, storing the numeric ID is fairly volatile (if a preset stored in code is overriden, it gets a new numeric ID, which the imagecache profiles module doesn't pick up). The attached patch switches the module to store the preset name instead, which is constant across a preset stored in code, and then overridden. The patch also adds an update hook for updating this on existing sites.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | imagecache_profiles.presetname.patch | 2.01 KB | jhedstrom |
Comments
Comment #1
jhedstromAnd the patch.
Comment #2
andypostWhat do you mean by "can be defined in code"? What code can define preset? Take a look at #349331: Views 2 Support in 6.x + optimizations
Comment #3
jhedstromImagecache presets, like views, panels and other exportables, can be defined by a module, using hook_imagecache_default_presets() (#255421: Patch for imagecache preset exporting). When one of these presets is set as one of the profile images, if that preset is then overridden, this module doesn't pick up the change, and in fact reverts to using no presets at all. This patch resolves that by using the preset name, which is unique, but more permanent than the imagecache preset ID.
Comment #4
andypostSo it needs work to catch this update and change ID to new. I see no reason to store reset name which could be changed more often
Comment #5
jhedstromImagecache itself uses the preset name rather than the numeric ID. Take a look at imagecache_field_formatter_info() and imagecache_theme() functions. Because of this, the Views module, and any other module that uses CCK formatters for displaying data is storing the preset name.
Comment #6
andypostI see no valuable reason to store preset name because if any contrib would try to use hook_imagecache_default_presets() then it should assign this preset to ICP variable and at this stage it's not a problem to get current ID of provided preset name.
ICP works at _preprocess stage so it's MORE OFTEN preset name could be changed against imported.
ICP should follow more common using... which is manually choosing a preset
Comment #7
amitaibuFeatures module also exportes imagecache by *name* e.g:
Comment #8
andypostAs I said before - Preset name and variable value is different.
You could export presets and then you should configure variables, at this stage you should convert preset-name into real ID which stored in DB and variable
Comment #9
yhahn commentedI am continuing this thread here #718678: Allow imagecache presets to be referenced by name.