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

havran - June 6, 2008 - 07:44
Status:active» patch (code needs review)

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

sun - June 6, 2008 - 19:42
Category:support request» task
Status:patch (code needs review)» patch (code needs work)

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

havran - June 6, 2008 - 20:53
Status:patch (code needs work)» patch (code needs review)

Here is patch.

AttachmentSize
inline.module.patch2.13 KB

#4

sun - June 7, 2008 - 16:46
Status:patch (code needs review)» patch (code needs work)

I think you accidentally removed '!presets' => from the fieldset description, so the ImageCache settings path won't be replaced.

#5

havran - June 7, 2008 - 19:05

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

havran - June 7, 2008 - 19:07
Status:patch (code needs work)» patch (code needs review)

Here :).

AttachmentSize
inline.module.2.patch2.1 KB

#7

sun - June 8, 2008 - 01:18

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

havran - June 8, 2008 - 12:15

Thanks to review, here is (i hope) final patch.

AttachmentSize
inline.module.3.patch2.08 KB

#9

JamieR - June 12, 2008 - 21:58

Patch applied and is working for me thus far... Thanks havran!

#10

sun - June 14, 2008 - 14:52
Status:patch (code needs review)» patch (code needs work)

Hm. Patch does not apply against DRUPAL--5, resp. latest development snapshot. Could you re-roll, please?

#11

havran - June 14, 2008 - 22:26
Status:patch (code needs work)» patch (code needs review)

Here is same patch against DRUPAL-5.

AttachmentSize
inline.module.4.patch2.18 KB

#12

sun - June 15, 2008 - 02:30

Hrm... much duplicate code. What about attached patch?

AttachmentSize
inline-DRUPAL-5.imagecache.patch2.26 KB

#13

micah - July 2, 2008 - 19:43

Patch #12 worked for me in a couple of different environments:

  • Drupal 5.7, ImageCache 5.x-1.6, Thickbox 5.x-1.2
  • Drupal 5.7, ImageAPI 5.x-1.2, ImageCache 5.x-2.1, Thickbox 5.x-2.0

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

sun - July 4, 2008 - 23:45
Status:patch (code needs review)» patch (reviewed & tested by the community)

#15

sun - July 5, 2008 - 00:21
Status:patch (reviewed & tested by the community)» fixed

Committed to HEAD, 5.x-2.x, and 5.x-1.x.

#16

Anonymous (not verified) - July 23, 2008 - 10:56
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.