I'm using ImageMagick as my image application. I want to create an Imagecache preset which is based on 'add text' which is not currently supported using ImageMagick (I've checked 6.x-1.x-dev as well). It seems to me that I have 3 options (ignoring the one of switching back to GD2) and I need some input to help me get going on any of these. I've looked through imagecache_actions files, looked at image api etc but didn't find all the answers:
1) Write the IM equivalent for the GD function. Where would this go, where is the gd code I'm replacing and what's the reference for the way I structure the IM commands.
2) Use custom command - what's my reference/documentation for how I structure this to use IM?
3) Force this particular preset to use GD - where/how could I do this? (I am not trying to mix IM/GD within one preset, this whole preset can be done in GD but others must be in IM).
Any help on this much appreciated. Obviously 1) would hopefully allow me to create a patch to add IM support for this action.

Comments

dman’s picture

:-)
All three options are valid!

3) Mixing and matching gd/imagemagick presets on one site is something I've done already - to support a testsuite utility of my own I use for developing. But it's not the way forward.

2) Examples exist for custom_actions mainly for gd #525852: custom code to flip/mirror images but if you look at the few imagemagic attempts I've made,
canvasactions.inc:imageapi_imagemagick_image_definecanvas() the trick is to keep adding imagemagick commands to $image->ops[] . They all get run together in one commandline at the end.

1) Would be lovely, and I've actually got huge structural changes coming for text generation in my dev version.
"Where would it go" is a good question, because we are sort of replacing a task that should be done by the image toolkit itself (IMO). imageapi_image_overlaytext_alpha() and its toolkit-delegated version imageapi_gd_image_overlaytext_alpha() used to line in textactions.inc (which I'm deprecating)

The new generation of text handling (very sexy) is the project ImageAPI_text. ImageMagick is in the TODO there. If you see The documentation I hope you'll see why it would be cool.
All my code is available in CVS

... that's all a bit hazy I guess. I've been meaning to get that out there and branch a 6.x-2 version of this architectural stuff.

Um, so for now, try method 2! If you find a good way of actually doing it, we can roll it into a text 'action', but everything that can be done is possible through the custom_actions box. If not, then it can't be done.

Tony Sharpe’s picture

Thanks dman, that got me started and after hunting around and seeing how things work I've got a basic
function imageapi_imagemagick_image_overlaytext_alpha starting to do something so I've got the 'Hello world' if IM text processing working. I'll see where I can get to with it.

dman’s picture

Status: Active » Closed (won't fix)

I've re-done text handling in gd. I have no idea where to start to port it to imagemagick though.