Integration with Imagecache 2
policleto - January 25, 2008 - 17:12
| Project: | Inline |
| Version: | 5.x-1.1 |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
The major rewrite of Imagecache breaks the compatibility with the inline module.
In fact, lot of functions of Imagecache (looking for a better code compatibility and readability) has been renamed.
I find that the collaboration between Inline and Imagecache is the best way (most intuitive one) to insert images on posts and manage them with minor hassle.
An imagecache_compat.module was planned, but the author is not going to release this compatibility layer anymore.
Could we find support in the Inline developmment?
Is possible an Inline-side update to get this working with the new version of Imagecache?
Thank you a lot!

#1
Here is moddification latest Inline for Imagecache 2 (add + lines into inline.module from line 83):
if (module_exists('imagecache')) {$options = array();
$options[''] = 'No Imagecache processing';
+ if (function_exists('_imagecache_get_presets')) {
+ // for Imagecache < 2.0
+ $presets = _imagecache_get_presets();
+ }
+ else {
+ // for Imagecache 2.0
+ $presets = array();
+ $presets_tmp = imagecache_presets();
+ foreach ($presets_tmp as $id => $preset) {
+ $presets[$preset['presetid']] = $preset['presetname'];
+ }
+ }
foreach ($presets as $id => $name) {
$options[$name] = $name;
}
#2
I need a proper patch (see http://drupal.org/patch/create) and I would like to see the same code as in #259471: Update for ImageCache 2 API
#3
Here is patch.
#4
I think you accidentally removed
'!presets' =>from the fieldset description, so the ImageCache settings path won't be replaced.#5
In Imagecache 2.0 is path for ImageCache settings
admin/build/imagecache. For this reason i use condition which set correct path in'!presets' => array(...). This is work in my installation correctly and i get ImageCache settings page. I testing this only with ImageCache 2.0.Here is bit moddified patch.
#6
Here :).
#7
oww... now I get it! You've turned $imagecache_path into an array already:
<?php$imagecache_path = array('!presets' => url('admin/settings/imagecache'));
?>
Please don't do that. t() and the arguments to t() belong together. It's okay to prepare $imagecache_path somewhere else, but the overall structure should look like:
<?php$imagecache_path = url('admin/settings/imagecache');
[...]
t('...', array('!presets' => $imagecache_path);
?>
So if the string in t() will ever be updated, one will find the contained argument right next to it.
#8
Thanks to review, here is (i hope) final patch.
#9
Patch applied and is working for me thus far... Thanks havran!
#10
Hm. Patch does not apply against DRUPAL--5, resp. latest development snapshot. Could you re-roll, please?
#11
Here is same patch against DRUPAL-5.
#12
Hrm... much duplicate code. What about attached patch?
#13
Patch #12 worked for me in a couple of different environments:
Patch applied to latest (2008-Jun-15) 5.x-1.x-dev.
You may note from this that it did not break ImageCache 5.x-1.x compatibility.
Micah
#14
#15
Committed to HEAD, 5.x-2.x, and 5.x-1.x.
#16
Automatically closed -- issue fixed for two weeks with no activity.