Class yii\imagine\Image

Inheritanceyii\imagine\Image » yii\imagine\BaseImage
Available since version2.0
Source Code https://github.com/yiisoft/yii2-imagine/blob/master/Image.php

Image implements most commonly used image manipulation functions using the Imagine library.

Example of use:

// generate a thumbnail image
Image::thumbnail('@webroot/img/test-image.jpg'120120)
    ->
save(Yii::getAlias('@runtime/thumb-test-image.jpg'), ['quality' => 50]);

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$driver array|string The driver to use. yii\imagine\BaseImage

Public Methods

Hide inherited methods

MethodDescriptionDefined By
crop() Crops an image. yii\imagine\BaseImage
frame() Adds a frame around of the image. Please note that the image size will increase by $margin x 2. yii\imagine\BaseImage
getImagine() Returns the Imagine object that supports various image manipulations. yii\imagine\BaseImage
setImagine() yii\imagine\BaseImage
text() Draws a text string on an existing image. yii\imagine\BaseImage
thumbnail() Creates a thumbnail image. The function differs from \Imagine\Image\ImageInterface::thumbnail() function that it keeps the aspect ratio of the image. yii\imagine\BaseImage
watermark() Adds a watermark to an existing image. yii\imagine\BaseImage

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
createImagine() Creates an Imagine object based on the specified $driver. yii\imagine\BaseImage

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
DRIVER_GD2 'gd2' GD2 driver definition for Imagine implementation using the GD library. yii\imagine\BaseImage
DRIVER_GMAGICK 'gmagick' Gmagick driver definition. yii\imagine\BaseImage
DRIVER_IMAGICK 'imagick' Imagick driver definition. yii\imagine\BaseImage