This patch is an introductory patch to add all the functionality of ImageAPI and most of ImageCache into Drupal core. Considering better media handling is the #1 requested feature for Drupal core, I think this counts as critical for the release of Drupal 7.
This patch implements the following portions of ImageAPI:
- Abstracted image "actions", allowing any module to provide new actions.
- New core actions in addition to the current scale, crop, and resize: scale and crop, desaturate, and rotate.
- Batch processing of image actions by passing image resources around instead of files.
In addition this patch implements the following portions of ImageCache:
- The ability to define "presets" for images, combining any number of available actions.
- Administrative section for configuring image presets and actions.
- Nearly "on-the-fly" image generation as images are requested.
This patch differs from current approaches in the following ways:
- Images are generated by calls to image_preset_generate() rather than through a menu callback, so you can't just request an image derivative by visiting it's URL.
- Images are generated by separate HTTP requests called by the server, rather than the client. This way we get the ability for each image to get it's own PHP instance (and memory limit), while not needing the requirement of Clean URLs.
- If you don't like the default mechanism for generating images (then we should improve it, but) you can swap out the mechanism entirely to provide the current mechanism that ImageCache currently uses by setting the variable "image_preset_generation_method".
- Works with or without both Clean URLs and Private Downloads.
- Thanks to the new hook_file(), image derivatives are automatically deleted whenever the original file is deleted.
And as a sample implementation, this patch adds the following features:
- Integrates with user.module to allow administrators to select an image preset for user profile pictures.
- Increases the default user variables for profile image dimensions and size from 85x85 to 1024x1024 and from 30Kb to 800Kb respectively.
- Enables user profile images and sets up a default image preset for "thumbnail_square" (at 85x85 pixels) in the default install profile.
There are still things to do, but this is a fully working patch. On the docket: write new simpletests for all the new APIs, improve the UI for setting up image presets, and do some performance testing. Not everything needs to be done in this one issue, but the image parts so far are rather cohesive in terms of functionality. The user picture implementation is only a dozen lines or so and is good as an example.