yii2mod/yii2-image Provides methods for the dynamic manipulation of images. Various image formats such as JPEG, PNG, and GIF can be resized, cropped, rotated.

extension

Yii2 Image Component

Provides methods for the dynamic manipulation of images. Various image formats such as JPEG, PNG, and GIF can be resized, cropped, rotated.

Latest Stable Version Total Downloads License

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yii2mod/yii2-image "*"

or add

"yii2mod/yii2-image": "*"

to the require section of your composer.json.

Usage

To use this extension, you have to configure the Connection class in your application configuration:

//configure component:
return [
    //....
    'components' => [
        'image' => [
            'class' => 'yii2mod\image\ImageComponent',
        ],
    ]
];

//add behavior to the model 
public function behaviors()
    {
        return [
            'image' => [
                'class' => ImageBehavior::className(),
                'pathAttribute' => 'path'
            ],
        ];
    }

// add image action to SiteController
public function actions()
{
    return [
        'image' => 'yii2mod\image\actions\ImageAction'
    ];
}

Usage example:

$imageModel->url('home'); // home is the type of photo, depending on type resize/crop/watermark/etc actions will happen

Configuring image types (yii params configuration section should be used):

'params' => [
        .....
        'image' => [
            'medium' => [
                'thumbnail' => [
                    'box' => [194, 194],
                    'mode' => 'outbound'
                ],
                'visible' => 'user' //checking role before outputing url
            ],
            'home' => [
                'thumbnail' => [
                    'box' => [640, 480],
                    'mode' => 'inset'
                ],
                'watermark' => [
                    'watermarkFilename' => '@app/web/images/watermark.png'
                ],

            ]
        ]
    ],

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require imagine/imagine "0.6.2 as 0.5.1"
php composer.phar require --prefer-dist yii2mod/yii2-image "*"

or add

"imagine/imagine": "0.6.2 as 0.5.1",
"yii2mod/yii2-image": "*"

to the require section of your composer.json.

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



1.0.0 is the latest of one release



MIT license
Stats
21 github stars & 8 github forks
0 downloads in the last day
11 downloads in the last 30 days
910 total downloads