#21712 [Fbk->Opn]: Using ImageCreateFromJPEG with ImageTTFText causes type to appear jagged

From: Date: Fri, 17 Jan 2003 20:34:00 +0000
Subject: #21712 [Fbk->Opn]: Using ImageCreateFromJPEG with ImageTTFText causes type to appear jagged
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-30391@lists.php.net to get a copy of this message
ID: 21712 User updated by: gkopp@ideastar.com Reported By: gkopp@ideastar.com -Status: Feedback +Status: Open Bug Type: GD related Operating System: RedHat 6.1 PHP Version: 4.3.0 New Comment: Not sure about which libttf version. I know I have freetype-2.0.9 installed on the machine with the link below. Not sure if that helps. http://tpol.ideastar.com/test.php The code that produces bad results: <?php $text = "Jagged Text"; Header("Content-type: image/png"); $source_file = "bluebox.jpg"; $target_id = ImageCreateFromJPEG ($source_file); $fontsize = 36; $xpos = 20; $ypos = 40; $font_color = ImageColorAllocate ($target_id, 255, 255, 255); $font = "/usr/local/www/archer/FRAMDCN.TTF"; ImageTTFText ($target_id, $fontsize, 0, $xpos, $ypos, $font_color, $font, $text); ImageJpeg($target_id); ImageDestroy($target_id); ?> The code that produces good results (trial and error figured this one out): <? $text = "Clear Text"; header("Content-type: image/png"); $source_file = "bluebox.jpg"; $source_size = getimagesize($source_file); $source_w = $source_size[0]; $source_h = $source_size[1]; $source_id = ImageCreateFromJPEG($source_file); $target_id = ImageCreate ($source_w, $source_h); ImageCopyResampled($target_id, $source_id, 0, 0, 0, 0, $source_w, $source_h, $source_w, $source_h); $fontsize = 36; $xpos = 20; $ypos = 40; $font_color = ImageColorAllocate ($target_id, 255, 255, 255); $font = "/usr/local/www/archer/FRAMDCN.TTF"; ImageTTFText ($target_id, $fontsize, 0, $xpos, $ypos, $font_color, $font, $text); ImagePNG ($target_id); ImageDestroy ($target_id); ?> Previous Comments: ------------------------------------------------------------------------ [2003-01-17 14:09:01] iliaa@php.net I've tried to duplicate the problem you've described using PHP 4.3.0 using bundled GD and PHP 4.2.3 using standard GD. Both produce absolutely identical images with the TTF (arial) font that I've used. What version of freetype library are you using and if possible can you put the 'good' & 'bad' image online for comparison reasons. ------------------------------------------------------------------------ [2003-01-17 12:59:10] gkopp@ideastar.com They are equal. Basically, this code takes a template image, and places some dynamic text on top of it. It's used to make custom header graphics for a site, without the need to create new images in Photoshop, etc. ------------------------------------------------------------------------ [2003-01-17 12:39:27] iliaa@php.net Are the dimentions of the 'source' image greater, less then or equal to the size of the 'destination' image? ------------------------------------------------------------------------ [2003-01-17 09:18:20] gkopp@ideastar.com I assume the bundled library. Although the unbundled library did exist on this machine before I compiled the new PHP. And it was version 2.0.1. ------------------------------------------------------------------------ [2003-01-17 08:48:28] iliaa@php.net Are you using bundled or non-bundled GD library? In case of the latter, what version of GD library are you using? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/21712 -- Edit this bug report at http://bugs.php.net/?id=21712&edit=1

« previous php.bugs (#30391) next »