Thanks for all the recent commits! There's still a lot of ass-kicking left to be done by this module though! The first step is to seperate actions out into seperate files, allowing easy creation of new actions. Each seperate file should at least include:

- The form for configuring the action
- Validation of the configuration form (right now there's no validation on actions)
- Help description for each action
- Logic for processing the action

There are two was to go about this: .inc files or .module files. I'm fairly impartial to which method we use, but each has it's advantages:

.module:
- Actions may be disabled if not desired
- 3rd party enhancements are simple to create/add without modifying the 'core' imagecache
- Other modules could use these 'image actions' for different purposes

.inc:
- Keeps the list of modules short (this will be less of a problem in 5.0 when we have categories finally)
- Slightly easier implementation/more familiar

Well, after that summary I kind of convinced myself that the .module method is the more 'Drupal' way of doing things. Maybe if we prefixed all the files 'imageaction_' it would make it clear they belong together? Then we'd have 4 modules in the distibution:

imagecache.module
imageactions/imageaction_crop.module
imageactions/imageaction_scale.module
imageactions/imageaction_resize.module

@dopry, what do you think?

Comments

dopry’s picture

You can find some of my thoughts in the fileapi group on groups....
http://groups.drupal.org/node/1569

I'm kind of back and forth on these things... I like the little include files. Like Dries I'm not exactly a fan of multi-module modules. I think discreet things like this can be done simply enough and actions can be enabled/disabled as needed. Whether its is a hook or an include is a different issue. I kind of like the hook idea for this particular case.

I've also been thinking of attempting to extend action.module to have a sense of applicable type (node, comment, user, file, etc...)

quicksketch’s picture

Hmm, yes this is all very interesting. Extending actions to things like image would be wildly powerful. I'd hate to invest my time into a dead-end module that just so happens to be very useful (think flexinode or even my own work on webform). We're definately headed towards not only more specialized modules, but more powerful module based frameworks (like cck, votingapi and actions).

I'd say let's try to make these modules, allowing them to be reused in a scenario like you described in your groups post. It would be sweet if we can put together something that can later be used in the fileapi without much trouble.

dopry’s picture

Version: 4.7.x-1.x-dev » 6.x-2.x-dev

see transformer.module... it still needs love, but I'm getting there... The admin ui is a vast improvement over imagecache, IMHO.. now I just have to make it work.

quicksketch’s picture

Awesome dopry, really looking forward to the improvements (esp the splitting of files into .incs!) I've got some great actions to add.

dopry’s picture

Status: Active » Closed (fixed)

This is sorta done in HEAD... module still needs call back...