Administrators usually create presets with one or more actions, but it is possible to create a preset with no actions. Where no actions are specified for a preset, an image is served up without transformation. Currently imagecache loads and saves the image using imageapi, even where no actions are specified. This destroys animated .gifs.
Here is my use case. I'm using the ad_image module to serve up ads. The ad_image module does not check for last modified headers so images are served up on every request. I could duplicate the imagecache checking for file modification times into the ad_image module. But, I would prefer to take advantage of the existing code in imagecache by creating a 'banner' preset with no actions. However, the imagecache module breaks my animated .gif files (it removes all frames after the first one).
The attached patch simply performs a file_copy where there are no actions specified.
It's worth noting that a preset gives users to access any image file in the files folder, regardless of the view permission set on the module used to upload the image. For example, using the CCK imagefield module, if 'view imagefield uploads' is FALSE for anonymous users, but 'view imagecache [preset]' is TRUE for anonymous users, anonymous users may view the uploaded file (but only via the imagecache preset path). This is helpful in my use case where I want to use a 'banner' preset to serve ads to anonymous users, while denying anonymous users access to all other uploaded files. Perhaps others will be surprised by this behaviour!