Methods
Constructor. Parameter $image should be:
1. An instance of image driver class (copy instance).
__construct(mixed $image,array $options = array())
- An image represented by the type of the $image property
(resource or object).
- An array with two elements. First - width, second - height.
Creates a blank image.
- A filename string. Get image form file.
Second paramaeter is used by pass some specific image driver options
Arguments
Magic method which allows read-only access to all protected or private
class properties
__get(string $property): mixed
final
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
Returns an array. Element 0 - image resource. Element 1 - width. Element 2 - height.
buildImage(mixed $image): array
final
Returns FALSE on failure.
Arguments
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
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
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
Checks if the drivers in the array parameter could be used. Returns first
found one
getDriver(array $drivers = array('gd')): string
staticfinal
Arguments
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
Returns calculated proportional height from the given width
getPropHeight(integer $resizedWidth): integer
final
Arguments
Response
integer
Returns calculated proportional width from the given height
getPropWidth(integer $resizedHeight): integer
final
Arguments
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
Response
boolean
Resize image. Should return TRUE on success or FALSE on failure
resize(integer $width,integer $height): boolean
abstract
Arguments
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
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
Response
boolean
Rotate image
rotate(integer $angle,string $background = "#000000"): boolean
abstract
Arguments
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
Response
boolean
Constants
DEFAULT_JPEG_QUALITY
DEFAULT_JPEG_QUALITY
Properties
Image resource or object
image :mixed
Image width in pixels
width :integer
Image height in pixels
height :integer
Init error
initError :boolean
Driver specific options
options :array