Download the PHP package rvdlee/zf-image-optimiser without Composer
On this page you can find all versions of the php package rvdlee/zf-image-optimiser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rvdlee/zf-image-optimiser
More information about rvdlee/zf-image-optimiser
Files in rvdlee/zf-image-optimiser
Package zf-image-optimiser
Short Description A package that allows you optimise images. To reduce in size with very slight quality loss.
License MIT
Homepage https://thoughtforcoding.com/
Informations about the package zf-image-optimiser
ZF3 Package to optimize images
This is a image optimiser package. I've written this with ZF3 in mind, everything is written with configuration over convention in mind. Highly extendible and easy in use. Currently supporting Gifsicle, JpegOptim, Optipng and pngquant2.
This package provides the following ways of converting:
- Through the commandline
- InputFilter
- Sevice
Usage
To get started you need to configure your validation chain. The validation chain acts as a validator for the files that are due to processing. There is a provided config dist file with all the configuration you need to get started.
The validator chain will require the standard zend validators to verify if the file is suitable to be handled by these adapters. It will look like something like this.
InputFilters
The standard file handling through forms is done with InputFilters in Zend, the InputFilter in this package allows you to save or overwrite the uploaded image. By default behaviour it will overwrite to be more inline with other file handling filters.
Here a example of an InputFilter in a FormInputFilter file using the ImageOptimiser filter to reduce filesize.
Commandline
The commandline controller is nothing more than a wrapper for the service calling optimise()
. You can access this controller by running the following command from CLI.
Service
The service class allows you to apply this package virtually everywhere in your ZF3 application. We support logging and catch all output given from the programs doing the optimalisation.
The service by default gets decked out with a default Zend\Log\Writer\Mock
writer. You can still access the logs in this writer. You can override this when building the service. Allowing you to provide a DB, Logfile or Stdout writer.
If you want to access the logs in the Mock writer, just use the following snippet. Locate the Mock writer and then look at the events.
FAQs
There are none at the moment.
All versions of zf-image-optimiser with dependencies
zendframework/zend-modulemanager Version ^2.8
zendframework/zend-servicemanager Version ^2.7.8 || ^3.3
zendframework/zend-filter Version ^2.9
zendframework/zend-validator Version *
zendframework/zend-stdlib Version ^3.2