Re: Trouble with php generated images

From: Date: Wed, 31 Oct 2001 07:38:24 +0000
Subject: Re: Trouble with php generated images
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-72989@lists.php.net to get a copy of this message
Give ImagePNG a try... -Jason Garber At 10:22 PM 10/29/2001 -0800, costa wrote:
The text printed on this image looks sloppy and grainy. (This image is being generated on a linux server RH 7.1, Apache 1.3.19, with GD 1.8) I remember seeing something about adjusting the quality of the image, but I can't find it now, and even if I did, I don't know how much help it would be, because I also recall seeing that it defaulted to 100. My question is this, is there a way to generate a quality image or improve the quality of this image, or am I stuck? As a side note, images that don't contain text seem to generate very cleanly. Would it be possible to make the background transparent, like a transparent gif? -C <?php ################################################ ### draw an image for the header and print some stuff on it. ############################################### ## tell the browser what it is header("Content-type: image/jpeg"); ## draw a new image $width = 600; $height = 100; $image = imagecreate($width, $height); ##make the background same as page $backg = imagecolorallocate($image, 0, 51, 102); ##make the text white $text = imagecolorallocate($image, 255, 255, 255); imagefilledrectangle($image, 0, 0, $width, $height, $backg); imagettftext($image, 30, 0, 200, 25, $text, ## now let's print some text to the image "/usr/share/fonts/ttf/GARAIT.TTF", "foo"); imagettftext($image, 40, 0, 60, 75, $text, "/usr/share/fonts/ttf/GARAIT.TTF", "some guy"); ## off it goes imagejpeg($image); ## cleanup imagedestroy($image); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.general (#72989) next »