:) This was fun.
See attached illustrations for a quick idea.
Using the code image.module, I added a response to hook_image_alter - (which gets called for every _image_build_derivatives) so that the thumbnail (etc) building can be handed off to the imagecache pipeline!
Now, all thumbnails get resized, colour-shifted and decorated at create time.
I realize that I could have got similar results by over-riding the image_gallery.module themes in many places and redirected requests to an imagecache/path all the time, but that approach simply wasn't integrated enough with the way that the rest of Drupal works. It was much more sensible for me to change the thumbnail than to change (in all the various places it may be referenced) the path to it.
Also, this approach ties in pretty powerfully with the existing 'derivatives' menu that's already part of core.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | image_imagecache_ui.png | 57.86 KB | dman |
| construction_gallery.png | 175.26 KB | dman |
Comments
Comment #1
dman commentedHere's a snapshot of the UI
Comment #2
dman commentedAnd here's the relevant bit of the code.
Not a patch yet, as (my version of) the core is unstable pending a bit of collabaration.
Note, I've abstracted a nominal function
imagecache_generate_image()which contains the meat of the do-everything function currently known asimagecache_cache()It should be obvious what it does ;-).
I'm just throwing this 'issue' out there as a proof-of-concept for folk to look at. If we can work together to get the pending rewrite in then this can be added later. Or maybe it's overkill and I'm trying to pack too much utility into this module. I dunno.
Comment #3
dopry commentedI've abstracted out imagecache_build_derivative and imagecache_apply_ action which should make it easier to integrate the two or build a glue module.
Comment #4
dman commentedsounds good. I'll see if I can revisit this sometime soon.
I've been meaning to have a look at the process abstractions to be able to contribute my other filters anyway. Seen in this eg is a transparency filter, a colour shift and an SVG rendering. (SVG may be a bit ambitious, but I'll run the other two up into callbacks for us)
Then see if this glue patch will still hold.
You see what fun it could be to run processes on our previews .... :-)
Comment #5
dopry commentedwith D6 previews won't be a problem. yeah!
Comment #6
dopry commentedI'm leaving this integration to a glue module.