So I'm processing the original image in the public files directory and have everything working so that I have a result in tmp.

For drupal6 I'd set the path to the file and return true; and my result would be copied to the appropriate imagecache directory.

For drupal 7 it just returns the original image. How do I return my image to imagecache?

$image->source = $tmpdir.'/'.$output_image_name;
return true;

Comments

fietserwin’s picture

Status: Active » Closed (works as designed)

This is explained in the readme.txt from the customactions module and depends on whether you are using the imagemagick or GD toolkit. In the former case you should add your command line arguments to the $image->ops array, in the latter case, you should not save your image but make $image->resource refer to your final GD resource.

sgriffin’s picture

Status: Closed (works as designed) » Active

In using a third party program. Neither gd or im.

dman’s picture

So, um, what part of imagecache_actions are you using?
Generally one or the other would be required for the system to even try and do anything.

sgriffin’s picture

I'm using ptstitcher for processing a panoramic image. I have everything working. The result is just waiting in tmp. This is actually an upgrade to my d6 module. There it was easy. I just set image->source to the path of the result and it was used.

sgriffin’s picture

I'm using the image cache actions for to specify input and output parameters and the call back effect function to pass the image object to build the command and run it.

dman’s picture

I don't understand what you are saying about how you use imagecache_actions here. Which of the actions are you using? A PHP customaction?
Are you sure this question is about the effects provided by this module, or is this a support request about how to build effects like the ones that this module provides?

What does the system *think* it's using? - GD or IM. Image derivatives just won't process unless one of those is chosen - even if you are choosing to ignore it.

If the system expects you to be using GD, you could potentially just read in your temp image from that file using GD, and set the $image->resource to that data.

sgriffin’s picture

Sorry, It's a custom imachecache actions module.

Ok great. How do I read in the image using gd?

dman’s picture

After setting the $image->source to the path of the file you've just made,
you could call Drupals

 image_gd_load($image);

which would re-load and re-initialize the ->resource

This means that when the time comes for the system to save the new file in the new derivative place, it's your data that gets saved.

... that's one way to start trying anyway.

sgriffin’s picture

You are awesome dman@! Worked like a charm.
I believe you helped me 5 years ago on the first version of this module.

Thank you SO much!

sgriffin’s picture

Status: Active » Closed (works as designed)
sgriffin’s picture

Status: Closed (works as designed) » Active

[columbo]One more question![/columbo]
The image style still has the original image dimensions when outputted. How do I change this? In the custom actions docs, it says to set the image info width and height, but its not working when the image displayed is set to my imagecache style.

<img typeof="foaf:Image" src="http://xxx.seeit360.com/sites/default/files/styles/test/public/coit_s.jpg?itok=_q-HPJTq" width="3000" height="1500" alt="">

$image->info['width'] = $action['output']['p_w'];
  $image->info['height'] = $action['output']['p_h'];
  $image->source = $tmpdir.'/'.$output_image_name;
  watchdog('info','imagecache_ptstitch_image: '.$image->info['width'].'x'.$image->info['height']);
  image_gd_load($image);
sgriffin’s picture

Status: Active » Closed (fixed)

Nevermind got it!

    'dimensions callback' => 'imagecache_subroutine_dimensions',
dman’s picture

Status: Closed (fixed) » Active

Yeah that is an annoying callback that was added in D7.
You need to use a callback now. Most of the core effects have predictable dimensions so it works. A few of my effects just don't.

dman’s picture

Status: Active » Closed (works as designed)

xpost