Closed (works as designed)
Project:
ImageCache Actions
Version:
6.x-1.6
Component:
Custom Actions Module
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
13 Jun 2009 at 09:15 UTC
Updated:
30 Oct 2009 at 13:42 UTC
Hello,
I'm trying to find documentation on writing a new action for imagecache_action.
It would be really simple, I'm looking for a way to rename a preset's generated file.
For example, I have a file called: 'image.jpg', if my preset is called: 'medium', then the file generated would be image_medium.jpg
First of all, do you think it's possible to do it in imagecache_action or it must be done in another module ?
Second, where should I begin to learn how to write imagecache_actions ?
Thanks for your support ;)
Comments
Comment #1
dman commentedimagecache_actions happen in the middle of the imagecache process. It's imagecache module that handles saving to a new filename at the end. In the normal course of events, imagecache_actions just get passed a handle on a binary data image object, change it a bit, and hand it back. So imagecache_actions don't get to define filenames.
It would be possible to save out the file in the middle if you really wanted - use the imagecache_actions : custom action - and you could probably just trigger imageapi_image_close() on it and you'd have what you want.
However, what imagecache does of course is save its files in files/presetname/image.jpg, and there's not a lot of difference between than and what you want. In most cases you can work with either convention.
For a full solution, you need to describe what and why you are actually trying to do, because you may want to investigate other solutions, or just address imageapi calls directly. OTOH, imagecache also can be triggered from code... so you could try that.
Comment #2
polThanks for the reply, I'll try to do it :)
As soon as I have found it, I'll post the bit of code here ;)
Comment #3
dman commentedclosing the issue