2017 © Pedro Peláez
 

yii2-extension yii2-imagecache

Yii2 image cache

image

whagency/yii2-imagecache

Yii2 image cache

  • Monday, June 25, 2018
  • by whagency
  • Repository
  • 1 Watchers
  • 4 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

yii2-imagecache

Yii2 extension for generating images based on Imagick, (*1)

Latest Stable Version License, (*2)

Capabilities

  • [x] FIT - resize image WITH proportion and based on BOTH sides
  • [x] Scale - resize image WITH proportion and based on ONE sides
  • [x] Crop - crop image WITH proportion
  • [x] Generate black-and-white image
  • [x] Add watermark to the image
  • [x] Add background color for FITed images

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require "whagency/yii2-imagecache" "*"

or add to your composer.json file, (*5)

"require": {
    "whagency/yii2-imagecache": "*"
},

Config

'components' => [
    ...
    'imageCache' => [
        'class' => 'webheads\imagecache\imageCache',
        'cachePath' => '@app/web/files/cache',
        'cacheUrl' => '@web/files/cache',
    ],
]

Usage Example PHP 8.0

Yii::$app->imageCache->img('/files/image.jpg', imagick_options: ['fit' => 300, 'bg' => '#ff0000', 'watermark' => '@app/web/files/images/wmk.png'])
// Result: image 300 x 300 without cropping, with watermark and background color.

Usage Example

echo Yii::$app->imageCache->imgSrc('@app/web/files/image.jpg', '', ['fit' => 300, 'bw' => true, 'watermark' => '@app/web/files/watermark-image.png']);
// Result: path to black-and-white image 300 x 300 without cropping, with watermark.

echo Yii::$app->imageCache->img('@app/web/files/image.jpg', '400x', ['class'=>'my-class', 'alt' => 'Image']);
// Result: scaled image with width = 400, alt and class.

echo Yii::$app->imageCache->img('@app/web/files/image.jpg', '100x150', ['alt' => 'Image'], ['bw' => true]);
// Result: resized and cropped black-and-white image 100 x 150 with alt.

The Versions

25/06 2018

dev-master

9999999-dev

Yii2 image cache

  Sources   Download

MIT

The Requires

 

cache yii2 image resize crop thumbnail watermark

25/06 2018

1.0.3

1.0.3.0

Yii2 image cache

  Sources   Download

MIT

The Requires

 

cache yii2 image resize crop thumbnail watermark

20/06 2018

1.0.2

1.0.2.0

Yii2 image cache

  Sources   Download

MIT

The Requires

 

cache yii2 image resize crop thumbnail watermark

20/06 2018

1.0.1

1.0.1.0

Yii2 image cache

  Sources   Download

MIT

The Requires

 

cache yii2 image resize crop thumbnail watermark