PHP image manipulation class
This class provides an easy to use library to the PHP GD-based imagefunctions
Constructor Summary
Image_Toolbox -- The class constructor.
Method Summary
addImage -- Adds a new image resource based on the given parameters.
addText -- Writes text over the image
blend -- Blend two images.
getServerFeatures -- Returns an assocative array with information about the image features of this server
newImage -- Flush all image resources and init a new one
newOutputSize -- Resize the current image
output -- Output a image to the browser
save -- Save a image to disk
setResizeMethod -- Sets the resize method of choice
The class constructor.
Image_Toolbox ( void)
Determines the image features of the server and sets the according values.
Additionally you can specify a image to be created/loaded. like addImage.
If no parameter is given, no image resource will be generated
Or:
string $file imagefile to load
Or:
integer $width imagewidth of new image to be created
integer $height imageheight of new image to be created
string $fillcolor optional fill the new image with this color (hexformat, e.g. '#FF0000')
Adds a new image resource based on the given parameters.
addImage ( void)
It does not overwrite the existing image resource.
Instead it is used to load a second image to merge with the existing image.
Parameter:
string $file imagefile to load
Or:
integer $width imagewidth of new image to be created
integer $height imageheight of new image to be created
string $fillcolor optional fill the new image with this color (hexformat, e.g. '#FF0000')
Writes text over the image
addText ( string text, string font, integer size, string color, string|integer x, string|integer y [, integer angle])
only TTF fonts are supported at the moment
$x:
You can also use the following keywords ('left', 'center' or 'middle', 'right').
Additionally you can specify an offset in pixel with the keywords like this 'left +10'.
(default = 0)
$y:
You can also use the following keywords ('top', 'center' or 'middle', 'bottom').
Additionally you can specify an offset in pixel with the keywords like this 'bottom -10'.
(default = 0)
Blend two images.
blend ( [ string|integer x [, integer y [, integer mode [, integer percent]]]])
Original image and the image loaded with addImage
IMPORTANT: imagecopymerged doesn't work with PHP 4.3.2. Bug ID: 24816
$x:
negative values are possible.
You can also use the following keywords ('left', 'center' or 'middle', 'right').
Additionally you can specify an offset in pixel with the keywords like this 'left +10'.
(default = 0)
$y:
negative values are possible.
You can also use the following keywords ('top', 'center' or 'middle', 'bottom').
Additionally you can specify an offset in pixel with the keywords like this 'bottom -10'.
(default = 0)
Possible values for $mode:
Returns an assocative array with information about the image features of this server
array getServerFeatures ( void)
Array values:
Flush all image resources and init a new one
newImage ( void)
Parameter:
string $file imagefile to load
Or:
integer $width imagewidth of new image to be created
integer $height imageheight of new image to be created
string $fillcolor optional fill the new image with this color (hexformat, e.g. '#FF0000')
Resize the current image
bool newOutputSize ( integer width, integer height [, bool crop [, bool autorotate]])
if $width = 0 the new width will be calculated from the $height value preserving the correct aspectratio.
if $height = 0 the new height will be calculated from the $width value preserving the correct aspectratio.
if $crop is set to true the image will be cropped if necessary to preserve the aspectratio and avoid image distortions.
(default = false)
if $autorotate is set to true the given $width and $height values may "change place" if the given image bias is different from the original one.
if either $width or $height is 0, the new size will be applied to either the new width or the new height based on the bias value of the original image.
(default = false)
Output a image to the browser
bool output ( [ string|integer output_type [, integer output_quality [, bool dither]]])
$output_type can be one of the following:
Save a image to disk
bool save ( string filename [, string|integer output_type [, integer output_quality [, bool dither]]])
$output_type can be one of the following:
Sets the resize method of choice
bool setResizeMethod ( string|integer method)
$method can be one of the following: