Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.
This module solves the problem where if the image is already in the correct resolution and compression, imagecache processes that image anyway.
In some cases we do need to change the image scales, which imagecache does well. But in many cases the images are already in the correct resolution and the problem is imagecache is still regenerating those images with the results being worse quality and larger file sizes.
The solution: If the file already has the correct dimensions of the current preset, only copy the file into the directory of that imagecache preset instead of allowing imagecache to process the image.
- Creation of the hook imagecache_preprocess_cache that is invoked before the imagecache image is built allowing an implementation of the hook to intercept, validate and process the cache in various ways. Imagecache already validates the image and preset before building the cache and, for example, redirects the user in case of an error or outputs an existing image cache, but it doesn't allow you to add your custom validation, so this hook solves that problem.