Download the PHP package brendt/responsive-images without Composer
On this page you can find all versions of the php package brendt/responsive-images. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download brendt/responsive-images
More information about brendt/responsive-images
Files in brendt/responsive-images
Package responsive-images
Short Description Create responsive images with PHP, using the srcset and sizes spec.
License MIT
Informations about the package responsive-images
Responsive Images
Automatically generate responsive images to work with the srcset
and sizes
spec. (http://responsiveimages.org/)
Usage
This sample would generate something like:
Configuration
The ResponsiveFactory
can take a ResponsiveFactoryConfigurator
object which will set the needed parameters.
A default configurator DefaultConfigurator
is provider out of the box, and uses the following parameters:
You can override these parameters by providing and array to the DefaultConfigurator
,
or create a whole new configurator which implements ResponsiveFactoryConfigurator
.
All configuration options
driver
: the image driver to use. Defaults togd
. Possible options aregd
orimagick
.includeSource
: whether to include the source image in thesrcset
. Defaults totrue
.sourcePath
: the path to load image source files. Defaults to./
.publicPath
: the path to render image files. Defaults to./
.rebase
: ignore the path of the requested image when searching in the source directory. Defaults tofalse
.enableCache
: enable or disable image caching. Enabling the cache wont' override existing images. Defaults tofalse
.optimize
: enable or disable the use of different optimizers (if installed on the system). Defaults tofalse
.scaler
: which scaler algorithm to use. Defaults tofilesize
. Possible options arefilesize
,width
orsizes
.stepModifier
: a percentage (between 0 and 1) which is used to create different image sizes. The higher this modifier, the more image variations will be rendered. Defaults to0.5
.minFileSize
: the minimum image filesize in bytes. Defaults to5000
B (5KB).maxFileSize
: the maximum image filesize in bytes. Defaults tonull
.minWidth
: the minimum image size in pixels. No images with size smaller than this number will be rendered. Defaults to300
pixels.maxWidth
: the maximum image size in pixels. No images with size smaller than this number will be rendered. Defaults tonull
.sizes
: this parameter is used when thesizes
scaler is enabled. This scaler will generate a fixed set of sizes, based on this array. The expected values are the widths of the generated images. Defaults to[]
(empty array).optimizerOptions
: options to pass to the image optimizer library. See https://github.com/psliwa/image-optimizer for more information.
Paths
The sourcePath
parameter is used to define where image source files are located.
In case of the first example and above configuration, the image file should be saved in ./src/img/image.jpeg
.
The publicPath
parameter is used to save rendered images into. This path should be the public directory of your website.
The above example would render images into ./public/img/image.jpeg
.
Path rebasing
When the rebase
option is enabled, source file lookup will differ: only the filename is used to search the file in the
source directory. An example would be the following.
All versions of responsive-images with dependencies
symfony/finder Version ^3.1
symfony/filesystem Version ^3.1
intervention/image Version ^2.3
ps/image-optimizer Version ^1.0