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())
  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
final

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
static

Response

boolean

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

buildImage(mixed $image): array
final

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
static

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
staticfinal

Arguments

$driver

string

$image

mixed

$options

array

Response

object

flipHorizontal

flipHorizontal()
abstract

flipVertical

flipVertical()
abstract

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
abstract

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
staticfinal

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
abstract

Arguments

$image

mixed

$width

integer

$height

integer

Response

mixed

Returns calculated proportional height from the given width

getPropHeight(integer $resizedWidth): integer
final

Arguments

$resizedWidth

integer

Response

integer

Returns calculated proportional width from the given height

getPropWidth(integer $resizedHeight): integer
final

Arguments

$resizedHeight

integer

Response

integer

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
abstract

Arguments

$type

string

$options

array

Response

boolean

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

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

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
abstract

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
abstract

Arguments

$width

integer

$height

integer

$background

mixed

Response

boolean

Rotate image

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

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
abstract

Arguments

$file

string

$left

mixed

$top

mixed

Response

boolean

Constants

DEFAULT_JPEG_QUALITY

DEFAULT_JPEG_QUALITY

Properties

Image resource or object

image :mixed
var

Type(s)

mixed

Image width in pixels

width :integer
var

Type(s)

integer

Image height in pixels

height :integer
var

Type(s)

integer

Init error

initError :boolean
var

Type(s)

boolean

Driver specific options

options :array
var

Type(s)

array