README.md 1.09 KB
Newer Older
Qiang Xue committed
1 2
Imagine Extension for Yii 2
===========================
Antonio Ramirez committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29

This extension adds most common image functions and also acts as a wrapper to [Imagine](http://imagine.readthedocs.org/)
image manipulation library.

Installation
------------

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require yiisoft/yii2-imagine "*"
```

or add

```json
"yiisoft/yii2-imagine": "*"
```

to the `require` section of your composer.json.


Usage & Documentation
---------------------

30 31
This extension is a wrapper to the [Imagine](http://imagine.readthedocs.org/) and also adds the most commonly used
image manipulation methods.
Antonio Ramirez committed
32

33
The following example shows how to use this extension:
Antonio Ramirez committed
34

35
```php
Antonio Ramirez committed
36 37
use yii\imagine\Image;

38 39
// frame, rotate and save an image
Image::frame('path/to/image.jpg', 5, '666', 0)
Antonio Ramirez committed
40 41
    ->rotate(-8)
    ->save('path/to/destination/image.jpg', ['quality' => 50]);
42 43 44 45
```

Note that each `Image` method returns an instance of `\Imagine\Image\ImageInterface`.
This means you can make use of the methods included in the `Imagine` library: