2017 © Pedro Peláez
 

yii2-extension yii2-image

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

image

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.

  • Friday, March 30, 2018
  • by disem
  • Repository
  • 6 Watchers
  • 27 Stars
  • 997 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 12 Forks
  • 1 Open issues
  • 3 Versions
  • 2 % Grown

The README.md

, (*1)

Yii2 Image Extension


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

Latest Stable Version Total Downloads License, (*3)

Installation

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

Either run, (*5)

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

or add, (*6)

"yii2mod/yii2-image": "*"

to the require section of your composer.json., (*7)

Configuration

Component Setup, (*8)

To use the Image Component, you need to configure the components array in your application configuration:, (*9)

'components' => [
    'image' => [
        'class' => 'yii2mod\image\ImageComponent',
    ],
],

Attach the behavior to the model, (*10)

You need to add the ImageBehavior to the your model., (*11)

public function behaviors()
{
    return [
        'image' => [
            'class' => ImageBehavior::class,
            'pathAttribute' => 'path',
        ],
    ];
}

Action Setup, (*12)

You need to add the ImageAction to the your controller., (*13)

public function actions()
{
    return [
        'image' => 'yii2mod\image\actions\ImageAction'
    ];
}

Configuring image types, (*14)

Next, you should configure your params section in your configuration file:, (*15)

'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',
            ],
        ],
    ],
],

Usage:

$model = Model::find()->one();
echo $model->url('medium'); // home is the type of photo.

Support us

Does your business depend on our contributions? Reach out and support us on Patreon. All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff., (*16)

The Versions

30/03 2018

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Igor Chepurnoi

extension yii2

30/03 2018

dev-feature-add-additional-packages

dev-feature-add-additional-packages

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Igor Chepurnoi

extension yii2

11/02 2015

1.0.0

1.0.0.0

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

  Sources   Download

Apache-2.0

The Requires

 

extension yii2