PHP code example of drishu / yii2-imagecache
1. Go to this page and download the library: Download drishu/yii2-imagecache 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/ */
drishu / yii2-imagecache example snippets
$config = [
'components' => [
...
'imagecache' => [
'class' => 'drishu\yii2imagecache\ImageCache',
// the below paths depend very much on your image upload setup
'sourcePath' => Yii::getAlias('@base'), // base path to your uploads dir
'cachePath' => '/data', // relative path to your uploads dir
],
...
],
];
<?= Html::img(Yii::$app->imagecache->get($image->path, '0x160'))
php composer.phar