2017 © Pedro Peláez
 

silverstripe-vendormodule silverstripe-image-quality

Adds Quality function to images

image

chrometoaster/silverstripe-image-quality

Adds Quality function to images

  • Wednesday, July 11, 2018
  • by michalkleiner
  • Repository
  • 4 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

SilverStripe Image Quality

Introduction

This extension adds a Quality method to images, that can be used to reduce the quality of images on a per-occurrence basis., (*1)

Higher quality images are larger, so reducing the quality will likely reduce the amount of data needed to be downloaded., (*2)

Requirements

  • SilverStripe 4

Installation

composer require chrometoaster/silverstripe-image-quality:~1.0

The instance gets automatically applied to Silverstripe\Assets\Image class., (*3)

Usage

You can define the image quality when outputting images in your templates by calling the Quality(X) method and passing in the desired image quality from 1 to 100., (*4)

It's highly recommended that Quality is always defined as the final image manipulation method - see the note below., (*5)

<img src="{$Image.Quality(50).Link}" />

<img src="{$Image.CroppedImage(300, 300).Quality(65).Link}" />

Implementation notes

SilverStripe applies each configured operation in order, generating a file for each operation., (*6)

This is why the Quality method cannot be used to raise the quality of image processing for the entire chain. Each operation is applied with the default quality, then the Quality method causes a larger file to be generated, containing the lower quality output from the previous operations., (*7)

This is also the reason why the Quality method must be the last in any chain; if it is not, then methods following Quality will act on a reduced quality image, but the output from those methods will be saved at the default quality, making the file both lower quality and larger than it would have been., (*8)

In theory, it would possible to control the image quality throughout the chain, but the way that SilverStripe caches intermediate results could cause unexpected side effects, as the quality of the image at intermediate stages would then depend on which method chain happened to render it first., (*9)

Licence

BSD-3-Clause, (*10)

The Versions

11/07 2018

1.0.2

1.0.2.0

Adds Quality function to images

  Sources   Download

BSD-3-Clause

The Requires

 

image silverstripe quality

11/07 2018

1.0.1

1.0.1.0

Adds Quality function to images

  Sources   Download

BSD-3-Clause

The Requires

 

image silverstripe quality

11/07 2018

dev-master

9999999-dev

Adds Quality function to images

  Sources   Download

BSD-3-Clause

The Requires

 

image silverstripe quality

11/07 2018

1.0.0

1.0.0.0

Adds Quality function to images

  Sources   Download

BSD-3-Clause

The Requires

 

image silverstripe quality