LimeSurvey API - Master branch

image_gmagick extends image

Table of Contents

Constants

DEFAULT_JPEG_QUALITY  = 75

Properties

$MIMES  : mixed
$height  : int
Image height in pixels
$image  : mixed
Image resource or object
$initError  : bool
Init error
$options  : array<string|int, mixed>
Driver specific options
$width  : int
Image width in pixels

Methods

__construct()  : mixed
Constructor. Parameter $image should be: 1. An instance of image driver class (copy instance).
__get()  : mixed
Magic method which allows read-only access to all protected or private class properties
available()  : bool
Checks if PHP needs some extra extensions to use the image driver. This static method should be implemented into driver classes like abstract methods
checkImage()  : bool
Checks if file is an image. This static method should be implemented into driver classes like abstract methods
factory()  : object
Factory pattern to load selected driver. $image and $options are passed to the constructor of the image driver
flipHorizontal()  : mixed
flipVertical()  : mixed
getDriver()  : string
Checks if the drivers in the array parameter could be used. Returns first found one
getPropHeight()  : int
Returns calculated proportional height from the given width
getPropWidth()  : int
Returns calculated proportional width from the given height
output()  : bool
Should output the image. Second parameter is used to pass some options like 'file' - if is set, the output will be written to a file 'quality' - compression quality It's possible to use extra specific options required by image type ($type)
resize()  : bool
Resize image. Should return TRUE on success or FALSE on failure
resizeCrop()  : bool
Resize and crop the image to fit in given resolution. Returns TRUE on success or FALSE on failure
resizeFit()  : bool
Resize image to fit in given resolution. Should returns TRUE on success or FALSE on failure. If $background is set, the image size will be $width x $height and the empty spaces (if any) will be filled with defined color. Background color examples: "#5f5", "#ff67ca", array(255, 255, 255)
rotate()  : bool
Rotate image
watermark()  : bool
Apply a PNG or GIF watermark to the image. $top and $left parameters sets the offset of the watermark in pixels. Boolean and NULL values are possible too. In default case (FALSE, FALSE) the watermark should be applyed to the bottom right corner. NULL values means center aligning. If the watermark is bigger than the image or it's partialy or fully outside the image, it shoudn't be applied
buildImage()  : array<string|int, mixed>
Returns an array. Element 0 - image resource. Element 1 - width. Element 2 - height.
getBlankImage()  : mixed
This method should create a blank image with selected size. Should returns resource or object related to the created image, which will be passed to $image property
getImage()  : mixed
This method should create an image from source image. Only first parameter ($image) is input. Its type should be filename string or a type of the $image property. See the constructor reference for details. The parametters $width and $height are output only. Should returns resource or object related to the created image, which will be passed to $image property
optimize_jpeg()  : mixed

Constants

DEFAULT_JPEG_QUALITY

public mixed DEFAULT_JPEG_QUALITY = 75

Properties

$height

Image height in pixels

protected int $height

$image

Image resource or object

protected mixed $image

$initError

Init error

protected bool $initError = false

$options

Driver specific options

protected array<string|int, mixed> $options = array()

Methods

__construct()

Constructor. Parameter $image should be: 1. An instance of image driver class (copy instance).

public __construct(mixed $image[, array<string|int, mixed> $options = array() ]) : mixed
  1. An image represented by the type of the $image property (resource or object).
  2. An array with two elements. First - width, second - height. Creates a blank image.
  3. A filename string. Get image form file. Second paramaeter is used by pass some specific image driver options
Parameters
$image : mixed
$options : array<string|int, mixed> = array()

__get()

Magic method which allows read-only access to all protected or private class properties

public final __get(string $property) : mixed
Parameters
$property : string

available()

Checks if PHP needs some extra extensions to use the image driver. This static method should be implemented into driver classes like abstract methods

public static available() : bool
Return values
bool

checkImage()

Checks if file is an image. This static method should be implemented into driver classes like abstract methods

public static checkImage(mixed $file) : bool
Parameters
$file : mixed
Return values
bool

factory()

Factory pattern to load selected driver. $image and $options are passed to the constructor of the image driver

public final static factory(string $driver, mixed $image[, array<string|int, mixed> $options = array() ]) : object
Parameters
$driver : string
$image : mixed
$options : array<string|int, mixed> = array()
Return values
object

getDriver()

Checks if the drivers in the array parameter could be used. Returns first found one

public final static getDriver([array<string|int, mixed> $drivers = array('gd') ]) : string
Parameters
$drivers : array<string|int, mixed> = array('gd')
Return values
string

getPropHeight()

Returns calculated proportional height from the given width

public final getPropHeight(int $resizedWidth) : int
Parameters
$resizedWidth : int
Return values
int

getPropWidth()

Returns calculated proportional width from the given height

public final getPropWidth(int $resizedHeight) : int
Parameters
$resizedHeight : int
Return values
int

output()

Should output the image. Second parameter is used to pass some options like 'file' - if is set, the output will be written to a file 'quality' - compression quality It's possible to use extra specific options required by image type ($type)

public output([mixed $type = "jpeg" ][, array<string|int, mixed> $options = array() ]) : bool
Parameters
$type : mixed = "jpeg"
$options : array<string|int, mixed> = array()
Return values
bool

resize()

Resize image. Should return TRUE on success or FALSE on failure

public resize(mixed $width, mixed $height) : bool
Parameters
$width : mixed
$height : mixed
Return values
bool

resizeCrop()

Resize and crop the image to fit in given resolution. Returns TRUE on success or FALSE on failure

public resizeCrop(mixed $width, mixed $height[, mixed $offset = false ]) : bool
Parameters
$width : mixed
$height : mixed
$offset : mixed = false
Return values
bool

resizeFit()

Resize image to fit in given resolution. Should returns TRUE on success or FALSE on failure. If $background is set, the image size will be $width x $height and the empty spaces (if any) will be filled with defined color. Background color examples: "#5f5", "#ff67ca", array(255, 255, 255)

public resizeFit(mixed $width, mixed $height[, mixed $background = false ]) : bool
Parameters
$width : mixed
$height : mixed
$background : mixed = false
Return values
bool

rotate()

Rotate image

public rotate(mixed $angle[, mixed $background = "#000000" ]) : bool
Parameters
$angle : mixed
$background : mixed = "#000000"
Return values
bool

watermark()

Apply a PNG or GIF watermark to the image. $top and $left parameters sets the offset of the watermark in pixels. Boolean and NULL values are possible too. In default case (FALSE, FALSE) the watermark should be applyed to the bottom right corner. NULL values means center aligning. If the watermark is bigger than the image or it's partialy or fully outside the image, it shoudn't be applied

public watermark(mixed $file[, mixed $left = false ][, mixed $top = false ]) : bool
Parameters
$file : mixed
$left : mixed = false
$top : mixed = false
Return values
bool

buildImage()

Returns an array. Element 0 - image resource. Element 1 - width. Element 2 - height.

protected final buildImage(mixed $image) : array<string|int, mixed>

Returns FALSE on failure.

Parameters
$image : mixed
Return values
array<string|int, mixed>

getBlankImage()

This method should create a blank image with selected size. Should returns resource or object related to the created image, which will be passed to $image property

protected getBlankImage(mixed $width, mixed $height) : mixed
Parameters
$width : mixed
$height : mixed

getImage()

This method should create an image from source image. Only first parameter ($image) is input. Its type should be filename string or a type of the $image property. See the constructor reference for details. The parametters $width and $height are output only. Should returns resource or object related to the created image, which will be passed to $image property

protected getImage(mixed $image, mixed &$width, mixed &$height) : mixed
Parameters
$image : mixed
$width : mixed
$height : mixed

optimize_jpeg()

protected optimize_jpeg([array<string|int, mixed> $options = array() ]) : mixed
Parameters
$options : array<string|int, mixed> = array()

        
On this page

Search results