03/06/2014

Better Drupal Image Styles

Bōwst

Image styles in Drupal are great for basic image cropping and resizing. You can upload an image once and easily reuse it across your site in different sizes. However, one thing that I have always found difficult is formatting images for image galleries. Most image gallery plugins assume that all the images in a specific gallery will be all the same aspect ratio. Image galleries look better when every image is full width, and you can just click through all the images and they fade in seamlessly. But in the real world, people want to upload portrait-size images alongside landscape-size images, and display them all in one gallery. Galleries have titles like “Trip to Spain,” not “Tall pictures in Spain” and/or “Wide pictures in Spain.”

So, how do you create a single image style that can crop images to a consistent aspect ratio for use in a gallery, (without cropping the heads off all your portraits) in Drupal? The Drupal Image Effect Kit has a solution. This module adds some additional effect options to image styles, including “Smart Resizer.” The Smart Resizer effect allows you to add optional padding to images that are the wrong aspect ratio, and set the color of the padding. You can also define what position the images are aligned at when the padding is added.

Drupal Image Effect Kit is a simple module that solves a simple problem that could otherwise cause major headaches and badly cropped image galleries.

More Thoughts

Need help with your next digital project?

Click on that button and fill in the simple form.