PHP code example of alpiiscky / yii2-image-cache

1. Go to this page and download the library: Download alpiiscky/yii2-image-cache 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/ */

    

alpiiscky / yii2-image-cache example snippets


'components' => [
    'thumb' => [
        'class' => 'alpiiscky\imagecache\Thumb' ,
        'cachePath' => '@webroot/cache',
        'options' => [
            'placeholder' => [
                'type' => \alpiiscky\imagecache\Thumb::THUMBNAIL_INSET,
                'backgroundColor' => '#f5f5f5',
                'textColor' => '#cdcdcd',
                'textSize' => 30,
                'text' => 'No image'
            ],
            'quality' => 92,
            'tinyPng' => [
                'apiKey' => null
            ]
        ]
    ]
]

<?= \alpiiscky\imagecache\ThumbWidget::widget([
      'image' => 'image.jpg',
      'img_class' => 'classes кроме img-responsive',
      'path' => 'images/',
      'width' => 120,
      'height' => 120,
      'mode' => \alpiiscky\imagecache\Thumb::CROP_CENTER
])