Renaming destination file according to preset and/or tokens module

Pol - June 13, 2009 - 09:15
Project:Imagecache Actions
Version:6.x-1.6
Component:Custom Actions Module
Category:support request
Priority:normal
Assigned:Pol
Status:by design
Description

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 ;)

#1

dman - June 18, 2009 - 11:47

imagecache_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.

#2

Pol - June 19, 2009 - 08:44

Thanks for the reply, I'll try to do it :)

As soon as I have found it, I'll post the bit of code here ;)

#3

dman - October 30, 2009 - 13:42
Status:active» by design

closing the issue

 
 

Drupal is a registered trademark of Dries Buytaert.