Closed (works as designed)
Project:
ImageCache Actions
Version:
6.x-2.x-dev
Component:
Custom Actions Module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Apr 2011 at 20:35 UTC
Updated:
10 Dec 2011 at 13:34 UTC
Comments
Comment #1
dman commentedNot a break flag
But you can easily do a switch statement.
Create a preset chain that does what you want to perform if true.
create a custom action that inspects the parameters, and calls the first preset as a subroutine if desired. And nothing (or something else) if not.
Syntax for invoking presets from another preset is pretty simple (though could be a little simpler). In fact that's the way half the core imagecache actions work.
That's what (for example) aspect switcher does.
the php code would be something like
... there is actually a bit more to it last time I tried, though that may have been fixed since.
See canvasactions_aspect_image() for the version with error-handling and co-ordinate conversions.
I guess we could add a utility call that would allow you to just invoke_preset($presetname, $image) so you could have 3 lines of php not 10
Comment #2
spelcheck commenteddman, THANK YOU.
Comment #3
demonrage commentednice code, but how to check the image type (gif.jpeg or png) with custom php code, cause i want image cache to pass gif files,
as u know image cahce destroys animated gifs and display them as still images .
thx
Comment #4
dman commented@demonrage
What have you tried so far?
There will be several clues to this available in the $image object that customactions can use. You can inspect the filename at least.
IIRC the MIME type is there too
Comment #5
demonrage commentedok dman,
i'm really don't know where to start from, is there any documentation or readme file that i can start from ??
Comment #6
dman commentedThere is stand-alone documentation displayed as help text within the form if you enable a custom action, including a full example of how to write your own process.
If you can't find that yet, I don't know what to suggest.
If you want to do more than the example, you should probably add some debugging code of your own that displays the available attributes of the $image object, and add your own logic based on that. If you are unable to add or work with PHP debuggging info, then PHP customactions is probably not the tool for you.