Download the PHP package tomlutzenberger/yii2-responsive-image without Composer
On this page you can find all versions of the php package tomlutzenberger/yii2-responsive-image. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tomlutzenberger/yii2-responsive-image
More information about tomlutzenberger/yii2-responsive-image
Files in tomlutzenberger/yii2-responsive-image
Package yii2-responsive-image
Short Description Create thumbnails with custom presets and use them in responsive widgets
License MIT
Informations about the package yii2-responsive-image
Yii2 Responsive Image
Create thumbnails with custom presets and use them in responsive widgets
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the required section of your composer.json
file.
Usage
Once the extension is installed, add the component to your web.php
:
Defining a preset
A preset is like a template for both the thumbnail generator and the picture widget.
Using the picture widget
Just set the source image and the presets you want to use.
Important:
- Path of the source image must be an alias and web-accessible, so either
@web
or@webroot
- Path of the source image need to match
srcPath
of the preset
You may als set pictureOptions
and imageOptions
depending on your needs.
Using the console command
The console command is intended to generate or flush thumbnails for all or just a single preset. If there are no thumbnails, they will be generated on demand (not recommended).
To use it, you need to add the same config to console.php
as you did in web.php
. However, it is recommended that you place your presets into params.php
to keep things clean and consistent.
Additionally, to be able to call the command, define the controller in the controller map:
Also, you need to define the aliases @web
and @webroot
in the yii
file:
All versions of yii2-responsive-image with dependencies
yiisoft/yii2 Version >=2.0.38
yiisoft/yii2-imagine Version ~2.2.0
symfony/console Version >=2.7 <5.0