Using the features module, I am generally able to import imagecache presets. However, when I create a compound preset using the imagecache_canvasactions modules, the preset does not import properly. If I go to admin/build/imagecache and click on the canvasactions preset, I get this error message:

warning: Invalid argument supplied for foreach() in /mysite/sites/all/modules/imagecache_actions/canvasactions.inc on line 1005.

And when I look at the imagecache_actions database table, I see there is no entry for the canvasactions preset.

The problem might be related to this one:
http://drupal.org/node/923996

Thanks for your help

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dman’s picture

(I'm getting php notices when working with features presets - could be fixed if #910008: PHP errors in imagecache_ui when viewing default presets goes in)

There could well be some troubles with the imagecache_actions that refer to others (aspect switcher or subroutine)
However, I'm not seeing any trouble with "define canvas".

Here's a feature that works fine for me:
Can you post yours?

kobnim’s picture

FileSize
1.29 KB

Here is an imagecache_canvas feature that is not working for me. It contains 3 presets:
(a) h500max: scale to height=500
(b) w500max: scale to width=500
(c) hw500max: combine (a) and (b) - scale so neither dimension exceeds 500

I tried your feature, and it works fine for me.

dman’s picture

Category: bug » feature

Yeah, your problem is not with the canvas feature at all.
It is - as I guessed - with the aspect switcher. canvasactions_aspect

That refers to the other presets by ID - as that is how imagecache normally does. However, if exporting and importing with the new features support, the ids of your presets are changed and invalid to the new location. That's all really normal.

Anyway, I went in and adjusted for that, as I'm now into supporting and adding features. Though it's a totally new addition to the code.
The current DRUPAL-6--2 dev branch has now been updated to use imagecache preset NAMES not IDs, and seems to now support import and export as expected. As you have done, you should export the required presets along with it. I'm not quite sure how to add a sub-preset as a dependency automatically.

DRUPAL-6--2 has a lot of changes - mostly shifting files around, but I haven't released it as 'stable' yet as I've not fully replaced the textactions in the rewrite. If you are not using textactions, then remove the old imagecache_actions altogether, and try the latest -2 dev

kobnim’s picture

Thanks, I'll get it a try!!

kobnim’s picture

I downloaded the 2.x version from October 10, but unfortunately it is not working for me.
I get this error message when I try to view my imported preset:

warning: Invalid argument supplied for foreach() in /mysite/sites/all/modules/contrib/imagecache_actions_2.x/canvasactions/canvasactions.inc on line 691.

Whenever you release another 2.x version, just let me know and I will give it another try.
And thanks for your very quick responses!! :)

dman’s picture

Hm.
6.x-2.x-dev 2010-Oct-19
is not good enough. The CVS should be bundling some (many) updates from the last few months.
I'll check the CVS settings :-}

dgtlmoon’s picture

subscribing

dgtlmoon’s picture

For now i'm working around this by doing a hook_update along the lines of (for example if anyone needs it)


mysql> insert into imagecache_preset (presetid, presetname) values (6, 'illustration-product-recipe');
Query OK, 1 row affected (0.00 sec)

mysql> insert into imagecache_action (actionid, presetid, weight, module, action, data) values (4,6,0,'imagecache_canvasactions', 'canvasactions_aspect', 'a:3:{s:8:"portrait";s:36:"illustration-product-recipe-portrait";s:9:"landscape";s:37:"illustration-product-recipe-landscape";s:16:"ratio_adjustment";s:1:"1";}');
Query OK, 1 row affected (0.00 sec)

andymantell’s picture

Just to say that I have updated to 6.x-2.x-dev as of 19th July 2011 and exporting a canvasactions_aspect preset to a feature is now working for me.

fietserwin’s picture

Status: Active » Closed (won't fix)

The 6.x-2.x is not supported anymore and we are closing all issues for it. Please feel free to reopen against the 7.x-1.x branch if the error still appears there.

@dman: if you know this error will be there, reopen it.

dman’s picture

Yeah, smells like this fix would need a backport from 6.x-2.x to 6.x-1.x.
But additional features support in 6 is low priority. Hm.

fietserwin’s picture

Status: Closed (won't fix) » Active

OK, we will have another look at it.

fietserwin’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

D6 EOL.