If you chose the action: "Generate configured preset" you will get:
Fatal error: Call to undefined function imagecache_generate_action_submit() in /var/www/web/WORKSPACE_DRUPAL/artwaves_drupal_texturesite/sites/all/modules/rules/rules/modules/rules.rules.inc on line 406

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

marcoka’s picture

Another bug ist taht if you mak an action "Node is going to be viewed" and use "Generate all presets for this filifield images", in every node i edit, the content gets dublicated on edit.

first edit "foo"
second "foo foo"
third "foo foo foo foo"

marcoka’s picture

I tested it with the option "New content is created". Its working with that option.

Coupon Code Swap’s picture

I'm getting the same error for: ImageCache: Generate configured preset(s) for this node's filefield images

with both New content and Updated content options. Tested with Imagecache dev (2010-Jul-10) and both Rules 6.x-1.2 and dev. After attempting to save:

Fatal error: Call to undefined function imagecache_generate_action_submit() in /public_html/sites/all/modules/rules/rules/modules/rules.rules.inc on line 406

the option: ImageCache: Generate ALL presets for this node's filefield images

is working.

Any ideas how to fix the error for configured preset(s)?

mikeytown2’s picture

/**
 * Action form submit implementation: Apply the core actions form submit
 */
function rules_core_action_execute_submit(&$settings, &$form, &$form_state) {
  $element = $form_state['element'];
  $info = rules_get_element_info($element);
  if ($info['configurable']) {
    $function = $info['action_name'] .'_submit'; 
    $settings = $function($form['settings'], $form_state) + $settings; // Line 406
  }
}

Here is where the error was introduced.
http://drupal.org/node/374202#comment-2921870

I think that imagecache_generate_action_submit() could be simplified by using array_filter().

Looks like rules requires _submit to be there.

mikeytown2’s picture

Status: Active » Needs review
FileSize
813 bytes

shot in the dark; let us know if it fixes the issue

Coupon Code Swap’s picture

Patch didn't work, I'm now getting this error:

Fatal error: Unsupported operand types in public_html/sites/all/modules/rules/rules/modules/rules.rules.inc on line 406

mikeytown2’s picture

FileSize
853 bytes

try this one

Coupon Code Swap’s picture

Getting warmer :)

I am now able to save the action. However, the check boxes for presets do not register. If I open the action again after saving, none of the presets are checked and so the action doesn't fire.

mikeytown2’s picture

FileSize
1007 bytes

decided to copy over the old code; this should work.

Coupon Code Swap’s picture

Sorry I didn't get back on this sooner.

http://drupal.org/comment/reply/813804/3311324#comment-3311324

that patch solves the issue.

mikeytown2’s picture

Status: Needs review » Reviewed & tested by the community
YK85’s picture

+1 subscribing

chuckbar77’s picture

subscribing

rjbrown99’s picture

#9 is working for me as well. I realize this is RTBC already but I figure one more positive bit of feedback doesn't hurt.

mikeytown2’s picture

FYI: I've come up with a better alternative to this for most use cases.
http://drupal.org/project/imageinfo_cache
Rules integration is still important for some unique use cases (that I use) but the imageinfo cache module should cover the vast majority of use cases with wanting to generate imagecache presets. Nice thing about my new module is it creates the presets right after you upload the image via an async callback; before you press save on the node edit form. By the time your done with creating the node all your presets have been generated.

rjbrown99’s picture

Thanks for the reference mikeytown2!

My issue is that I don't want to generate every preset for an image because I have 8-10 presets, with different presets used per content type. With hundreds of thousands of images it becomes a problem if I generate images for presets I don't use. My solution is to use a triggered rule, upon change of the field, to generate specific presets for that content type. It doesn't seem that imageinfo_cache can work granularly out-of-the-box without a bit of code enhancement. Not that I'm opposed to doing that, but at least for now rules works great.

I'd really love to do this with a queue (either D6 drupal_queue module or perhaps Amazon SQS) and offloading of image creation to a dedicated server or web service like Picnik. It's not ideal to tie up production web serving resources with CPU-intensive tasks like generating images. Even after moving to a custom roll of ImageMagick with libjpegturbo it still eats up a lot of system resources.

mikeytown2’s picture

I actually built imageinfo_cache to work granularly; the node type and cck field name are available at every point. I just haven't implemented filtering on that information yet.

We have a box on our production network for cron jobs and image generation. That is what I use imageinfo_cache to do; generate images on this box. I have imageinfo_cache pointed to that servers IP. imageinfo_cache is async, it works in the background, on demand.

drewish’s picture

Status: Reviewed & tested by the community » Needs work

If we're going to add the submit callback we should drop this bit:

  // Filter out false checkboxes: http://drupal.org/node/61760#comment-402631
  $form['array_filter'] = array('#type' => 'value', '#value' => TRUE);
fizk’s picture

Issue tags: +ImageCache 3

Marking as ImageCache 3.x Todo.

fizk’s picture

Category: bug » feature