ZenphotoCMS 1.6.1

graphicsImagick extends graphicsBase
in package

Class for image handling using the Imagick library

Requires Imagick 3.0.0+ and ImageMagick 6.3.8+

Tags
since
1.6
  • reworked as class

Table of Contents

$fontlist  : mixed
$gd_loaded  : mixed
$gd_present  : mixed
$generalinfo  : mixed
$imagemagick_version  : mixed
$imagemagick_version_pass  : mixed
$imagick_present  : mixed
$imagick_version  : mixed
$imagick_version_pass  : mixed
$info  : mixed
__construct()  : mixed
checkGraphicSupport()  : mixed
Check if a required graphics libary is available on the system Mzst be called by every graphics class related constructor to ensure that general properties are set properly
colorAllocate()  : ImagickPixel
Returns an RGB color identifier
copyCanvas()  : bool
Copies an image canvas
createImage()  : Imagick
Creates a true color image
drawRectangle()  : bool
Creates a rectangle
flipImage()  : object
Flips (mirrors) an image
flipRotateImage()  : object|false
Rotates and/or flips an image based on by using rotateImage() and flipImage() methods
getCounterClockwiseRotation()  : int
Returns the counter clockwise rotation degree the GD library requires
getFonts()  : array<string|int, mixed>
Returns a list of available fonts
graphicsLibInfo()  : mixed
imageBlurGD()  : mixed
imageCanRotate()  : bool
Returns true if Imagick library is configured with image rotation support
imageColorTransparent()  : bool
Sets the transparency color
imageDims()  : mixed
imageFill()  : bool
Fills an image area
imageFontHeight()  : int
Returns the font height in pixels
imageFontWidth()  : int
Returns the font width in pixels
imageFromString()  : Imagick
Creates an image from an image stream
imageGet()  : Imagick
Takes an image filename and returns an Imagick image object
imageGray()  : Imagick
Creates a grayscale image
imageHeight()  : int
Returns the height of an image resource
imageIPTC()  : mixed
imageKill()  : bool
Destroys an image resource
imageLoadFont()  : ImagickDraw
Loads a font and returns an object with the font loaded
imageMerge()  : bool
Does a copy merge of two image resources
imageOutput()  : bool
Outputs an image resource as a given type
imageResizeAlpha()  : Imagick
Resize a file with transparency to given dimensions and still retain the alpha channel information
imageResizeTransparent()  : type
Uses imageResizeAlpha() internally as Imagick does not make a difference
imageUnsharpMask()  : Imagick
Sharpens an image using an Unsharp Mask filter.
imageWidth()  : int
Returns the width of an image resource
resampleImage()  : bool
Resamples an image to a new copy
rotateImage()  : Imagick
Rotates an image resource according to its Orientation setting
writeString()  : bool
Renders a string into the image

Properties

Methods

checkGraphicSupport()

Check if a required graphics libary is available on the system Mzst be called by every graphics class related constructor to ensure that general properties are set properly

public checkGraphicSupport() : mixed
Tags
global

boolean $_zp_gd_present

global

type $_zp_imagick_present

global

type $_zp_imagick_version

global

type $_zp_imagick_version_pass

Return values
mixed

colorAllocate()

Returns an RGB color identifier

public colorAllocate(Imagick $image, int $red, int $green, int $blue) : ImagickPixel
Parameters
$image : Imagick
$red : int
$green : int
$blue : int
Return values
ImagickPixel

copyCanvas()

Copies an image canvas

public copyCanvas(Imagick $imgCanvas, Imagick $img, int $dest_x, int $dest_y, int $src_x, int $src_y, int $w, int $h) : bool
Parameters
$imgCanvas : Imagick

destination canvas

$img : Imagick

source canvas

$dest_x : int

destination x

$dest_y : int

destination y

$src_x : int

source x

$src_y : int

source y

$w : int

width

$h : int

height

Return values
bool

createImage()

Creates a true color image

public createImage(int $w, int $h[, bool $truecolor = true ]) : Imagick
Parameters
$w : int

the width of the image

$h : int

the height of the image

$truecolor : bool = true

True to create a true color image, false for usage with palette images like gifs

Return values
Imagick

drawRectangle()

Creates a rectangle

public drawRectangle(Imagick $image, int $x1, int $y1, int $x2, int $y2, ImagickPixel $color) : bool
Parameters
$image : Imagick
$x1 : int
$y1 : int
$x2 : int
$y2 : int
$color : ImagickPixel
Return values
bool

flipImage()

Flips (mirrors) an image

public flipImage(image $im[, string $mode = 'horizontal' ]) : object
Parameters
$im : image
$mode : string = 'horizontal'

"horizontal" (default) or "vertical"

Tags
since
1.6
Return values
object

flipRotateImage()

Rotates and/or flips an image based on by using rotateImage() and flipImage() methods

public flipRotateImage(object $im, array<string|int, mixed> $rotate) : object|false
Parameters
$im : object

GDImage or imagick image object

$rotate : array<string|int, mixed>

Two dimensional array with rotate and flip indexes as returned be getImageRotation()

Tags
since
1.6.1
Return values
object|false

getCounterClockwiseRotation()

Returns the counter clockwise rotation degree the GD library requires

public static getCounterClockwiseRotation(int $degree) : int
Parameters
$degree : int

Rotation degree clockwise

Tags
since
1.6.1

Adapted from anonymous comment on https://www.php.net/manual/en/imagick.rotateimage

Return values
int

getFonts()

Returns a list of available fonts

public getFonts() : array<string|int, mixed>
Return values
array<string|int, mixed>

imageBlurGD()

public imageBlurGD(mixed $imgCanvas, mixed $imgCanvas2, mixed $radius, mixed $w, mixed $h) : mixed
Parameters
$imgCanvas : mixed
$imgCanvas2 : mixed
$radius : mixed
$w : mixed
$h : mixed
Return values
mixed

imageCanRotate()

Returns true if Imagick library is configured with image rotation support

public imageCanRotate() : bool
Return values
bool

imageColorTransparent()

Sets the transparency color

public imageColorTransparent(Imagick $image, color $color) : bool
Parameters
$image : Imagick
$color : color
Return values
bool

imageDims()

public imageDims(mixed $filename) : mixed
Parameters
$filename : mixed
Return values
mixed

imageFill()

Fills an image area

public imageFill(Imagick $image, int $x, int $y, color $color) : bool
Parameters
$image : Imagick
$x : int
$y : int
$color : color
Return values
bool

imageFontHeight()

Returns the font height in pixels

public imageFontHeight(ImagickDraw $font) : int
Parameters
$font : ImagickDraw
Return values
int

imageFontWidth()

Returns the font width in pixels

public imageFontWidth(ImagickDraw $font) : int
Parameters
$font : ImagickDraw
Return values
int

imageFromString()

Creates an image from an image stream

public imageFromString(mixed $string) : Imagick
Parameters
$string : mixed
Return values
Imagick

imageGet()

Takes an image filename and returns an Imagick image object

public imageGet(string $imgfile) : Imagick
Parameters
$imgfile : string

the full path and filename of the image to load

Return values
Imagick

imageGray()

Creates a grayscale image

public imageGray(Imagick $image) : Imagick
Parameters
$image : Imagick

The image to grayscale

Return values
Imagick

imageHeight()

Returns the height of an image resource

public imageHeight(Imagick $im) : int
Parameters
$im : Imagick
Return values
int

imageIPTC()

public imageIPTC(mixed $filename) : mixed
Parameters
$filename : mixed
Return values
mixed

imageKill()

Destroys an image resource

public imageKill(Imagick $im) : bool
Parameters
$im : Imagick
Return values
bool

imageLoadFont()

Loads a font and returns an object with the font loaded

public imageLoadFont([string $font = NULL ][, mixed $size = 18 ]) : ImagickDraw
Parameters
$font : string = NULL
$size : mixed = 18
Return values
ImagickDraw

imageMerge()

Does a copy merge of two image resources

public imageMerge(Imagick $dst_im, Imagick $src_im, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_w, int $src_h, int $pct) : bool
Parameters
$dst_im : Imagick
$src_im : Imagick
$dst_x : int
$dst_y : int
$src_x : int
$src_y : int
$src_w : int
$src_h : int
$pct : int
Return values
bool

imageOutput()

Outputs an image resource as a given type

public imageOutput(Imagick $im, string $type[, string $filename = NULL ][, int $qual = 75 ]) : bool
Parameters
$im : Imagick
$type : string
$filename : string = NULL
$qual : int = 75
Return values
bool

imageResizeAlpha()

Resize a file with transparency to given dimensions and still retain the alpha channel information

public imageResizeAlpha(Imagick $src, int $w, int $h) : Imagick
Parameters
$src : Imagick
$w : int
$h : int
Return values
Imagick

imageResizeTransparent()

Uses imageResizeAlpha() internally as Imagick does not make a difference

public imageResizeTransparent(type $src, type $w, type $h) : type
Parameters
$src : type
$w : type
$h : type
Return values
type

imageUnsharpMask()

Sharpens an image using an Unsharp Mask filter.

public imageUnsharpMask(Imagick $img, int $amount, int $radius, int $threshold) : Imagick
Parameters
$img : Imagick

the image to sharpen

$amount : int

the strength of the sharpening effect

$radius : int

the pixel radius of the sharpening mask

$threshold : int

the color difference threshold required for sharpening

Return values
Imagick

imageWidth()

Returns the width of an image resource

public imageWidth(Imagick $im) : int
Parameters
$im : Imagick
Return values
int

resampleImage()

Resamples an image to a new copy

public resampleImage(Imagick $dst_image, Imagick $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h) : bool
Parameters
$dst_image : Imagick
$src_image : Imagick
$dst_x : int
$dst_y : int
$src_x : int
$src_y : int
$dst_w : int
$dst_h : int
$src_w : int
$src_h : int
Return values
bool

rotateImage()

Rotates an image resource according to its Orientation setting

public rotateImage(Imagick $im, int $rotate) : Imagick
Parameters
$im : Imagick

Imagick object

$rotate : int

Rotation degree clock wise

Return values
Imagick

writeString()

Renders a string into the image

public writeString(Imagick $image, ImagickDraw $font, int $x, int $y, string $string, ImagickPixel $color) : bool
Parameters
$image : Imagick
$font : ImagickDraw
$x : int
$y : int
$string : string
$color : ImagickPixel
Return values
bool

Search results