image_gd

Extends\kcfinder\image

package

KCFinder @version 3.12 @author Pavel Tzonkov sunhater@sunhater.com

Methods

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

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

Arguments

$image

mixed

$options

array

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

__get(string $property): mixed
inheritedfinal

Arguments

$property

string

Response

mixed

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

available(): boolean
inheritedstatic

Response

boolean

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

buildImage(mixed $image): array
inheritedfinal

Returns FALSE on failure.

Arguments

$image

mixed

Response

array

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

checkImage(string $file): boolean
inheritedstatic

Arguments

$file

string

Response

boolean

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

factory(string $driver,mixed $image,array $options = array()): object
inheritedstaticfinal

Arguments

$driver

string

$image

mixed

$options

array

Response

object

flipHorizontal

flipHorizontal()
inheritedabstract

flipVertical

flipVertical()
inheritedabstract

gdColor

gdColor()

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

getBlankImage(integer $width,integer $height): mixed
inheritedabstract

Arguments

$width

integer

$height

integer

Response

mixed

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

getDriver(array $drivers = array('gd')): string
inheritedstaticfinal

Arguments

$drivers

array

Response

string

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

getImage(mixed $image,integer &$width,integer &$height): mixed
inheritedabstract

Arguments

$image

mixed

$width

integer

$height

integer

Response

mixed

Returns calculated proportional height from the given width

getPropHeight(integer $resizedWidth): integer
inheritedfinal

Arguments

$resizedWidth

integer

Response

integer

Returns calculated proportional width from the given height

getPropWidth(integer $resizedHeight): integer
inheritedfinal

Arguments

$resizedHeight

integer

Response

integer

imageCopyResampled

imageCopyResampled( $src, $dstX, $dstY, $srcX, $srcY, $dstW = null, $dstH = null, $srcW = null, $srcH = null)

Arguments

$src

$dstX

$dstY

$srcX

$srcY

$dstW

$dstH

$srcW

$srcH

imageFilledRectangle

imageFilledRectangle( $x1, $y1, $x2, $y2, $color)

Arguments

$x1

$y1

$x2

$y2

$color

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)

output(string $type = 'jpeg',array $options = array()): boolean
inheritedabstract

Arguments

$type

string

$options

array

Response

boolean

output_gif

output_gif(array $options = array())

Arguments

$options

array

output_jpeg

output_jpeg(array $options = array())

Arguments

$options

array

output_png

output_png(array $options = array())

Arguments

$options

array

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

resize(integer $width,integer $height): boolean
inheritedabstract

Arguments

$width

integer

$height

integer

Response

boolean

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

resizeCrop( $width, $height,integer $offset = false): boolean
inheritedabstract

Arguments

$width

$height

$offset

integer

Response

boolean

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)

resizeFit(integer $width,integer $height,mixed $background = false): boolean
inheritedabstract

Arguments

$width

integer

$height

integer

$background

mixed

Response

boolean

Rotate image

rotate(integer $angle,string $background = "#000000"): boolean
inheritedabstract

Arguments

$angle

integer

$background

string

Response

boolean

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

watermark(string $file,mixed $left = false,mixed $top = false): boolean
inheritedabstract

Arguments

$file

string

$left

mixed

$top

mixed

Response

boolean

Constants

DEFAULT_JPEG_QUALITY

DEFAULT_JPEG_QUALITY
inherited

Properties

Image resource or object

image :mixed
inherited
var

Type(s)

mixed

Image width in pixels

width :integer
inherited
var

Type(s)

integer

Image height in pixels

height :integer
inherited
var

Type(s)

integer

Init error

initError :boolean
inherited
var

Type(s)

boolean

Driver specific options

options :array
inherited
var

Type(s)

array