Process image thumbnails "on upload". ImageAPI or your own API compatible with it?
Electronick - March 27, 2009 - 17:28
| Project: | Upload element |
| Version: | 6.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
I think this is a good idea.
But not sure that is attached directly to imageapi. Maybe its worth to create a API to communicate with the action of the handler to display an image. Let it be initially adjusted to the ImageAPI, but would not limit the developer to choose the means to work with images.
p.s. Thank you for the module. I have several times taken for the development of this, but all the time that it prevented me to finish and had to be subverted by each project individually.

#1
I was going to base things on ImageCache, but there are some issues, namely the limitation of where you can write/save files to. Because of this, I am considering using the ImageApi directly, not only for the image thumbnails but also any post upload modifications. Hopefully I'll get some free time soon to look into this some more.
My current thoughts are to:
I thought that this was going to a nice small afternoon project too, but ended up being considerably longer... I still haven't actually used it for the project that I was designing it for at the time.
#2
ImageCache is a simple way to show uploads thumbs "on air", but I am not sure whether the cached files are removed.
#3
I have just got some time to rework this module, and I'm refactoring significantly.
I am considering to use the the imageapi directly.
Each element will be able to specify 1 or more imageapi actions.
Each action is a simple, non-keyed array. The first element must be a valid function after 'imageapi_image_' is prefixed to it, with any additional values passed to the function as additional parameters after the image object.
<?php
$element['image-actions'] = array(
array('scale_and_crop', 80, 90),
array('rotate', 90, 0xffffff)
);
# resulting in the following internal calls
imageapi_image_scale_and_crop ($image, 80, 90);
imageapi_image_rotate ($image, 90, 0xffffff);
# untested implementation
function ue_apply_imageapi_actions($src, $actions) {
if (image_get_info($src)) {
if ($image = imageapi_image_open ($src)) {
foreach ($actions as $params) {
$function = 'imageapi_image_'. array_shift($params);
if (function_exists($function)) {
array_unshift($params, $image);
call_user_func_array($function, $params);
}
}
imageapi_image_close($image);
}
}
}
?>
#4
I'm not releasing any new features any more with the end of the road in sight with the release of Drupal 7.