Giter Club home page Giter Club logo

grav-plugin-resize-images's Introduction

Grav Resize Images Plugin

This plugin is still young! If you encounter any issues, please don't hesitate to report them.

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.

To generate variations of existing images go into the admin panel and re-save the pages where those images live. Every time a page is saved (whether it's new or old), this plugin will go through all images (again, whether they are new or old) in that page, check if they have responsive variants and generate new ones if necessary.

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.