Class: Image_Toolbox
Source Location: /Image_Toolbox.class.php
PHP image manipulation class
Author(s):
Version:
Copyright:
|
|
Inherited Variables
|
Inherited Methods
|
Class Details
Class Methods
constructor Image_Toolbox [line 161]
Image_Toolbox Image_Toolbox(
)
|
|
The class constructor. 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')
method addImage [line 927]
Adds a new image resource based on the given parameters. 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')
method addText [line 1283]
void addText(
string
$text, string
$font, integer
$size, string
$color, string|integer
$x, string|integer
$y, [integer
$angle = 0])
|
|
Writes text over the image 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)
Parameters:
method blend [line 979]
void blend(
[string|integer
$x = 0], [integer
$y = 0], [integer
$mode = IMAGE_TOOLBOX_BLEND_COPY], [integer
$percent = 100])
|
|
Blend two images. Original image and the image loaded with addImage NOTE: This operation can take very long and is not intended for realtime use. (but of course depends on the power of your server :) ) IMPORTANT: http://www.php.net/imagecopymerge 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: - IMAGE_TOOLBOX_BLEND_COPY
- IMAGE_TOOLBOX_BLEND_MULTIPLY
- IMAGE_TOOLBOX_BLEND_SCREEN
- IMAGE_TOOLBOX_BLEND_DIFFERENCE
- IMAGE_TOOLBOX_BLEND_EXCLUSION
- IMAGE_TOOLBOX_BLEND_OVERLAY
$percent: alpha value in percent of blend effect (0 - 100) (default = 100)
Parameters:
method getServerFeatures [line 225]
array getServerFeatures(
)
|
|
Returns an assocative array with information about the image features of this server Array values: - 'gd_version' -> what GD version is installed on this server (e.g. 2.0)
- 'gif' -> 0 = not supported, 1 = reading is supported, 2 = creating is supported
- 'jpg' -> 0 = not supported, 1 = reading is supported, 2 = creating is supported
- 'png' -> 0 = not supported, 1 = reading is supported, 2 = creating is supported
- 'ttf' -> TTF text creation. true = supported, false = not supported
method newImage [line 245]
Flush all image resources and init a new one 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')
method newOutputSize [line 791]
bool newOutputSize(
integer
$width, integer
$height, [integer
$mode = 0], [bool
$autorotate = false], [string
$bgcolor = '#000000'])
|
|
Resize the current image 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.
$mode can be one of the following: - 0 -> image will be resized to the new output size, regardless of the original aspectratio. (default)
- 1 -> image will be cropped if necessary to preserve the aspectratio and avoid image distortions.
- 2 -> image will be resized preserving its original aspectratio. differences to the new outputsize will be filled with $bgcolor
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)
Tags:
Parameters:
method output [line 504]
bool output(
[string|integer
$output_type = false], [integer
$output_quality = false], [bool
$dither = false])
|
|
Output a image to the browser $output_type can be one of the following: - 'gif' -> gif image (if supported) (8-bit indexed colors)
- 'png' -> png image (if supported) (truecolor)
- 'png8' -> png image (if supported) (8-bit indexed colors)
- 'jpg' -> jpeg image (if supported) (truecolor)
(default: same as original) $dither: If this is true than dither is used on the conversion from truecolor to 8-bit indexed imageformats (png8, gif) (default = false)
Tags:
Parameters:
method save [line 620]
bool save(
string
$filename, [string|integer
$output_type = false], [integer
$output_quality = false], [bool
$dither = false])
|
|
Save a image to disk $output_type can be one of the following: - 'gif' -> gif image (if supported) (8-bit indexed colors)
- 'png' -> png image (if supported) (truecolor)
- 'png8' -> png image (if supported) (8-bit indexed colors)
- 'jpg' -> jpeg image (if supported) (truecolor)
(default: same as original) $dither: If this is true than dither is used on the conversion from truecolor to 8-bit indexed imageformats (png8, gif) (default = false)
Tags:
Parameters:
method setResizeMethod [line 725]
bool setResizeMethod(
string|integer
$method)
|
|
Sets the resize method of choice $method can be one of the following: - 'resize' -> supported by every version of GD (fast but ugly resize of image)
- 'resample' -> only supported by GD version >= 2.0 (slower but antialiased resize of image)
- 'workaround' -> supported by every version of GD (workaround function for bicubic resizing, downsizing, VERY slow!, taken from php.net comments)
- 'workaround2' -> supported by every version of GD (alternative workaround function for bicubic resizing, down- and upsizing, VERY VERY slow!, taken from php.net comments)
Tags:
Parameters:
|
|