fredrikekelund/grav-plugin-resize-images


A Grav plugin for resizing images when they are uploaded

License: MIT

Language: PHP


Grav Resize Images Plugin

Resize images at upload time in the Grav admin

Grav provides some nifty built-in features for editing images on the fly through the use of Gregwar/Image. But there's no support yet for automatically generating responsive image alternatives at upload time rather than at request time. This plugin fixes that! It will automatically resize images that are uploaded through the Grav admin to a set of predetermined widths. This means improved performance for Grav, and less manual resizing work for you. Win-win! 🎉

Moreover, this plugin doesn't support just GD, but also Imagick, which means you'll get higher quality results than with the ImageMedium#derivatives method that can be used to generate image alternatives in theme templates.

Images that already have responsive alternatives won't be resized.

Configuration

You can customize the set of widths that your images will be resized to. By default they are 640, 1000, 1500, 2500, 3500 pixels in width. Images will never be scaled up, however, so only the widths that are smaller than the original image's will be used.

For every width, you're also able to set the JPEG compression quality. A good rule of thumb is to lower that number at higher widths - the result will still be good!

This plugin won't convert PNG's to JPEG's, so the quality number only applies to JPEG images.

Installation

Download the ZIP archive from GitHub and extract it to the user/plugins directory in your Grav installation.

CLI

I'm aiming to add support for CLI commands to this plugin as well, to make it easy to generate responsive image alternatives for already uploaded images.

Project Statistics

Sourcerank 4
Repository Size 16.6 KB
Stars 15
Forks 4
Watchers 1
Open issues 4
Dependencies 0
Contributors 1
Tags 0
Created
Last updated
Last pushed

Top Contributors See all

Fredrik Ekelund

Something wrong with this page? Make a suggestion

Last synced: 2016-10-14 12:47:26 UTC

Login to resync this repository