I'm trying to return a completely different image in a couple of different cases when and action is run, , but the unaltered image is returned instead and Im not sure why.
I've tried the following...

$success_image = imageapi_image_open(realpath(success.gif');
$image = $success_image;
return $image;

The following works fine, but it's not what I'm after.
return imageapi_image_crop($image, 1, 1, 80, 80);

I am processing the original not with gd or imagemagick and I don't care about the original image at all, I only want to move the result into the preset folder or return another graphic.

Thanks for any advice or pointers.

Comments

sgriffin’s picture

Yes, there's a syntax error. It was sanitized a little too much.
I was able to use imageapi_image_open in straight php and was able to access the image and attributes just not the same code with canvasactions.

sgriffin’s picture

Anyone?

dman’s picture

Status: Active » Postponed (maintainer needs more info)

When I looked at this issue, I just couldn't tell enough about the context from the short snippet.
Are you talking about running php with custom actions, or is there some interaction problem with a module you are developing??

You may be interested to know that the $image object is NOT a GD image resource. It's an object that contains extra metadata, including the dimensions, filenames, toolkit in use, and a $image->res object that is the GD resource you probably want to mess with. This is how all the imagecache processes function. Have a look at any of the existing code - eg imageapi_image_crop() to see how it actually does stuff.

sgriffin’s picture

Thanks I will take a look at it.
I was using imagecache to accept custom input values for transformations on an image, and the image is returned in a specified directory. The problem I was facing is getting a return of the output into the preset folder. So I was trying to replace/return $image with the output I created by the custom image program. I will take another stab at it. Thanks for the pointer.

sgriffin’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Not sure what I was thinking or if I am doing this right, but I was able to move the result into the proper preset place, and update $image->source and return true, and all is well. For some reason, I thought I would just return the image, and pass the ball back and imagecache would put it in the proper preset place itself.