1. Go to this page and download the library: Download fgh151/yii2-image-resize library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fgh151 / yii2-image-resize example snippets
'components' => [
'imageresize' => [
'class' => 'fgh151\imageresize\ImageResize',
//path web root
'cachePath' => '@frontend/web',
//path where to store thumbs
'cacheFolder' => 'upload/thumb',
//use filename (seo friendly) for resized images else use a hash
'useFilename' => true,
//show full url (for example in case of a API)
'absoluteUrl' => false,
],
],
/*
* $sImageFilePath_id: (ed) width height of the image
* $mode: "outbound" or "inset"
* $$quality: (1 - 100)
* $chosenFileName: if config -> components -> imageresize -> useFilename is true? its an option to give a custom name else use original file name
*/
\Yii::$app->imageresize->getUrl($imageFile, $width, $height, $mode, $quality, $chosenFileName);
php composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.