Description The imagecolorallocate function returns the color identifier for the passed red , green , and blue RGB parameters.. imagecolordeallocate Syntax int imagecolordeallocateint
Trang 1Description
The imagecolorallocate() function returns the color identifier for the passed red ,
green , and blue (RGB) parameters The image is the return value of the
imagecreate() function
imagecolordeallocate()
Syntax
int imagecolordeallocate(int image, int variable)
Description
The imagecolordeallocate() function, which was added in PHP 3.0.6, deallocates a color in image that was previously defined in variable by calling the
imagecolorallocate() function
imagecolorat()
Syntax
int imagecolorat(int image, int x, int y)
Description
The imagecolorat() function returns the index number of the color located at x and
y
imagecolorclosest()
Syntax
int imagecolorclosest(int image, int red, int green, int blue)
Description
The imagecolorclosest() function returns the index number of the color closest to
Trang 2Syntax
int imagecolorexact(int image, int red, int green, int blue)
Description
The imagecolorexact() function returns the index number of the color specified by the passed red , green , and blue (RGB) values If there is no color at that location,
–1 is returned
imagecolorresolve()
Syntax
int imagecolorresolve(int image, int red, int green, int blue)
Description
The imagecolorresolve() function, which was added in PHP 3.0.2, returns the index number of the color specified by the passed red , green , and blue (RGB)
values, or the color closest to that value
imagegammacorrect()
Syntax
int imagegammacorrect(int image, double input_gamma, double
output_gamma)
Description
The imagegammacorrect() function, which was added in PHP 3.0.13, applies the gamma correction to the image based on the input_gamma and output_gamma
imagecolorset()
Syntax
Trang 3boolean imagecolorset(int image, int index, int red, int green, int blue)
Description
The imagecolorset() function sets the color located at the index number passed to
the specified red , green , and blue (RGB) values for the image
imagecolorsforindex()
Syntax
array imagecolorsforindex(int image, int index)
Description
The imagecolorsforindex() function returns an associative array ("key" with an associated value) where the keys are red, green, and blue, and the values are their respective values at the index position in the image
imagecolorstotal()
Syntax
int imagecolorstotal(int image)
Description
The imagecolorstotal() function returns the total number of colors in the palette of the image passed
imagecolortransparent()
Syntax
int imagecolortransparent(int image [, int color])
Trang 4The imagecolortransparent() function defines the color passed as transparent in
the image
imagecopy()
Syntax
int imagecopy(int destination_image, int source_image, int
destination_x,
int destination_y, int source_x, int source_y, int source_width, int source_height)
Description
The imagecopy() function, which was added in PHP 3.0.6, copies the part of the
source_image , starting at the source_x and source_y point and constrained by the
source_width and source_height to the destination_image The copied portion is
placed on this image, starting at the destination_x and destination_y location
imagecopyresized()
Syntax
int imagecopyresized(int destination_image, int source_image,
int destination_x, int destination_y int source_x, int source_y, int destination_width, int destination_height, int source_width, int source_height)
Description
The imagecopyresized() function copies the part of the source_image , starting at
the source_x and source_y point and constrained by the source_width and
source_height to the destination_image The copied portion is placed on this
image starting at the destination_x and destination_y location, and stretched to
the destination_width and destination_height parameters
imagecreate()
Syntax
int imagecreate(int width, int height)
Trang 5Description
The imagecreate() function returns a blank image identifier of the size defined by the width and height parameters
imagecreatefromgif()
Syntax
int imagecreatefromgif(string location)
Description
The imagecreatefromgif() function returns an image identifier for the GIF image at
location , which can be a filename or URL If the process fails, the function returns
an error message To avoid this, you can use the following type of code in which you create an image if the one you seek is not there:
$image = imagecreatefromgif("myimage.gif");
if(!$image){ // check for error
$image = imagecreate(1, 1); // create blank image
$background = imagecolorallocate($image, 0, 0, 0); // white
imagefill($image, 0, 0, $background); // create white image
}
return $image;
imagecreatefromjpeg()
Syntax
int imagecreatefromjpeg(string location)
Description
The imagecreatefromjpeg() function returns an image identifier for the JPEG image
at location , which can be a filename or URL If the process fails, the function
returns an error message To avoid this, you can use the following type of code in which you create an image if the one you seek is not there:
$image = imagecreatefromjpeg("myimage.jpg");
if(!$image){ // check for error