Image Resize settings (Drupal 9+)
Image Resize settings

Drupal 9+ (1.x)

This module allows you to resize and convert existing and new images to a lower resolution and/or more modern image type. It is recommended to use this in combination with the imagemagick toolkit due to support for the quality setting, see feature list.

Warning This module converts the original image files, this process can not be undone. Create a backup before testing.

Features and limitations

  • Configure which image mime types the conversion is applied
  • Two resize modes, minimal or maximal size. Chose the one you prefer.
    • Minimal: Ensures that images keep at least the given size. Using 3000x3000 width/height will result in image sizes like 3000x4000 and 4000x3000. Very wide or narrow images will remain large, for example 8000x3000
    • Maximal: Ensures that images are below the given size, using 3000x3000 will for example result in images with sizes of 2000x3000 and 3000x2000. Very wide or narrow images will become very small, for example 500x3000
  • Allows to convert to any of the image formats that the chosen toolkit supports, like webp or avif. Note that some formats like avif can result in considerably longer conversion times and may not be fully supported yet by Drupal.
  • Imagemagick only: Set a specific quality for the conversion process. It is recommended to set a higher quality than the quality used for image styles, as the converted images will be used as source for image styles and applying lower quality multiple times will result in worse image quality. Also note that different image formats have different quality levels, see https://www.industrialempathy.com/posts/avif-webp-quality-settings
  • A minimum file size can be set to avoid checking and processing small images
  • Image processing happens using the queue.
  • The same settings are also applied to all images that are created, This is not yet configurable and also happens on cron to avoid delays. That does however mean that the image will be updated some time later and image styles need to be recreated
  • Drupal currently stores the width and height of images on image fields and not the file entities. The conversion process also updates all image fields based on file_usage data, it however only updates the current default revision, pending forward and past revisions are not altered yet.

Usage instructions

  1. Go to the module settings 'admin/config/media/image-resizer' page and set options for resizing you images.
  2. Optional: Add existing images to the queue that match the chosen criteria
  3. Run cron (will process the queue for up to 60 seconds each time), drush queue:run image_resize or another module to process the queue.

Sponsoring

Initial development of this has been sponsored by enSoie.

Drupal 7 (7.x.1x)

Before downloading and using this module please read the next lines carefully. This module has a very specific use case. You should not use it to resize images that are managed by Drupal. If your content type or taxonomy vocabulary has an image field, then images you upload to the nodes or terms of this type are most likely managed by Drupal.

Use this module if your images are not managed by Drupal. Let's say that for some reason you are loading images directly in templates, based on some file path pattern, then these images "live" outside of Drupal. This usually happens when you migrate from some other system and your images have specific names, so you can load them directly in the template. "Image resize" will resize only images in a specified folder, and it won't modify any table in your database.

How to use it?

1. Go to the module settings '/admin/config/media/image-resize/settings' page and set options for resizing you images.
2. Go to the '/admin/config/media/image-resize' page and start resizing images.

Requirements

Minimum PHP 5.5.0

Supporting organizations: 
sponsored development
Development, Maintenance of Drupal 9+ release

Project information

Releases