IMAGEGD2(3) 1 IMAGEGD2(3)imagegd2 - Output GD2 image to browser or fileSYNOPSIS
bool imagegd2 (resource $image, [string $filename], [int $chunk_size], [int $type = IMG_GD2_RAW])
DESCRIPTION
Outputs a GD2 image to the given $filename.
PARAMETERS
o $
image -An image resource, returned by one of the image creation functions, such as imagecreatetruecolor(3).
o $filename
-The path to save the file to. If not set or NULL, the raw image stream will be outputted directly.
o $chunk_size
- Chunk size.
o $type
- Either IMG_GD2_RAW or IMG_GD2_COMPRESSED. Default is IMG_GD2_RAW.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
Outputting a GD2 image
<?php
// Create a blank image and add some text
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
// Output the image
imagegd2($im);
// Free up memory
imagedestroy($im);
?>
Example #2
Saving a GD2 image
<?php
// Create a blank image and add some text
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
// Save the gd2 image
// The file format for GD2 images is .gd2, see http://www.libgd.org/GdFileFormats
imagegd2($im, 'simple.gd2');
// Free up memory
imagedestroy($im);
?>
NOTES
Note
This function requires GD 2.0.1 or later (2.0.28 or later is recommended).
Note
The GD2 format is commonly used to allow fast loading of parts of images. Note that the GD2 format is only usable in GD2-compatible
applications.
SEE ALSO imagegd(3).
PHP Documentation Group IMAGEGD2(3)
Check Out this Related Man Page
IMAGECREATEFROMGD2PART(3) 1 IMAGECREATEFROMGD2PART(3)imagecreatefromgd2part - Create a new image from a given part of GD2 file or URLSYNOPSIS
resource imagecreatefromgd2part (string $filename, int $srcX, int $srcY, int $width, int $height)
DESCRIPTION
Create a new image from a given part of GD2 file or URL.
Tip
A URL can be used as a filename with this function if the fopen wrappers have been enabled. See fopen(3) for more details on how to
specify the filename. See the "Supported Protocols and Wrappers" for links to information about what abilities the various wrappers
have, notes on their usage, and information on any predefined variables they may provide.
PARAMETERS
o $filename
- Path to the GD2 image.
o $srcX
- x-coordinate of source point.
o $srcY
- y-coordinate of source point.
o $width
-Source width.
o $height
-Source height.
RETURN VALUES
Returns an image resource identifier on success, FALSE on errors.
EXAMPLES
Example #1
imagecreatefromgd2part(3) example
<?php
// For this example we need the image size before
$image = getimagesize('./test.gd2');
// Create the image instance now we got the image
// sizes
$im = imagecreatefromgd2part('./test.gd2', 4, 4, ($image[0] / 2) - 6, ($image[1] / 2) - 6);
// Do an image operation, in this case we emboss the
// image if PHP 5+
if(function_exists('imagefilter'))
{
imagefilter($im, IMG_FILTER_EMBOSS);
}
// Save optimized image
imagegd2($im, './test_emboss.gd2');
imagedestroy($im);
?>
NOTES
Note
This function requires GD 2.0.1 or later (2.0.28 or later is recommended).
PHP Documentation Group IMAGECREATEFROMGD2PART(3)
Dear Frnds
We are having WHM Cpanel in which many website are their , one of our customer want to install Clientexec software which requires GD2.0.28(compatible) library which is installed.
The problem is libpng version which is incompatible with the GD library .
Please kindly... (0 Replies)
Dear Frnds
We are having WHM Cpanel in which many website are their , one of our customer want to install Clientexec software which requires GD2.0.28(compatible) library which is installed.
The problem is libpng version which is incompatible with the GD library .
Please kindly help for the... (0 Replies)
Discussion started by: naik_mit
0 Replies
3. Post Here to Contact Site Administrators and Moderators
Hi,
I am unable to view/open the image I uploded in one of the forums.
https://www.unix.com/showthread.php?t=37793&page=2&pp=20
Please help.
enc. (2 Replies)
Hi,
I have a file as below
I need to overwrite the 2 nd column alone to numeric format like "06122011030414012345" as per the timestamp value
output file should be
the microseconds can be neglected if required.
Any help will be appreciated.
Thanks in advance (1 Reply)
I have an image 46272-th.jpg
I would like to have the ability to add / onto the first 3 characters to allow me to mange my image names and move them to the appropriate folders.
So for example, the desired output would be.....
mv 46272-th.jpg 4/6/2/46272-th.jpg
Can anyone please help me? (2 Replies)