yii2-imgcache Image effect, thumb and cache extension for Yii2

  1. About
  2. Requirements
  3. Install
  4. Usage
  5. Resources
  6. License

Latest Stable Version Total Downloads License

About

The lireincore/imgcache integration for Yii2 framework.

Requirements

Install

Add the "lireincore/yii2-imgcache": "~0.3.0" package to your require section in the composer.json file

or

$ php composer.phar require lireincore/yii2-imgcache

Usage

To use this extension, you need to create the imgcache.php file in your config folder and add this code:

<?php

return [
    'srcdir' => '@app/files/uploads',
    'destdir' => '@webroot/thumbs',
    'webdir' => '@webroot',
    'baseurl' => '@web',
    //....
    'presets' => [
        'origin' => [
            'effects' => [
                //add the effects you need
                //....
            ],
        ],
    ],
];

See lireincore/imgcache README.md for more information about the available effects and other config options.

Also add the following code in your Yii2 application configuration:

$config = [
    //....
    'components' => [
        //....
        'imgcache'=> [
            'class' => \LireinCore\Yii2ImgCache\ImgCache::class,
            'config' => require(__DIR__ . '/imgcache.php'),
        ],
    ],
];

Use in your code:

//get thumb url for image '{srcdir}/blog/image.jpg' (preset 'origin')
$url = \Yii::$app->imgcache->url('blog/image.jpg', 'origin');

See lireincore/imgcache README.md for more information about the available functions.

Resources

License

The MIT License (MIT). Please see License File for more information.

0 0
1 follower
0 downloads
Yii Version: 2.0.*
License: MIT
Category: Caching
Developed by: lireincore
Created on: Mar 20, 2017
Last updated: 5 years ago
Github Repository

Related Extensions