ID: 17151 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Feedback Bug Type: *Graphics related Operating System: Linux PHP Version: 4.1.2 New Comment:
I'll check and let you know - thanks! Previous Comments: ------------------------------------------------------------------------ [2002-05-12 09:33:21] [EMAIL PROTECTED] PHP doesn't implement any of these low-level functions. They are implemented by the GD and Freetype libraries. Did you change/upgrade either of these? ------------------------------------------------------------------------ [2002-05-11 00:31:02] [EMAIL PROTECTED] ImageTTF* has stopped working the way it used to. I have sideways text on my site, and it worked great under earlier versions of PHP (for an example, please see http://AskNick.com, running under 4.0.6). Now, under >=4.1.2, specifying any angle for the text other than 0 results in a broken link (see http://SoundBytes.org - same code, running under 4.1.2). Same code running under 4.2.0 can be seen on http://sbarch.cob.rit.edu, but there I used a 45-degree angle, which I think illustrates the problem handily - each letter of the text is at an incorrect 90 degrees, althought the angle of the text itself is the correct 45 degrees. Had I used a 90-degree angle, then the letters would have been individually upside down, but the text would have been correctly vertical. Also, kerning between letters is way off at 90. Here is the code I'm using on all three sites: <?PHP header("Content-Type: image/gif"); // GRAFTEXT // takes: // $title - the text of the title // $titlecolor - the color of the title // $titlefont - the font for the title // $titlesize - font size of the title // $rotation - the angle of the title - 0 = normal; 90 = straight up // background will be transparent // THIS FUNCTION UNHEXIZES A COLOR function unhexize ($color) { $color = hexdec($color); $red = ($color&0xFF0000)>>16; $green = ($color&0xFF00)>>8; $blue = ($color&0xFF); return array ($red, $green, $blue); } // determine font height. $bbox = ImageTTFBBox($titlesize, $rotation, $titlefont, "W"); if ($rotation < 0) { $font_height = abs($bbox[7]-$bbox[1]); } else if ($rotation > 0) { $font_height = abs($bbox[1]-$bbox[7]); } else { $font_height = abs($bbox[7]-$bbox[1]); } // determine bounding box. $bbox = ImageTTFBBox($titlesize, $rotation, $titlefont, $title); if ($rotation < 0) { $width = abs($bbox[4]-$bbox[0]); $height = abs($bbox[3]-$bbox[7]); $offset_y = $font_height; $offset_x = 0; } else if ($rotation > 0) { $width = abs($bbox[2]-$bbox[6]); $height = abs($bbox[1]-$bbox[5]); $offset_y = abs($bbox[7]-$bbox[5])+$font_height; $offset_x = abs($bbox[0]-$bbox[6]); } else { $width = abs($bbox[4]-$bbox[6]); $height = abs($bbox[7]-$bbox[1]); $offset_y = $font_height; $offset_x = 0; } $bgc = unhexize($titlecolor); $im = ImageCreate($width+3,$height+3); $backcolor = ImageColorAllocate($im, 255, 255, 255); $trans = ImageColorTransparent($im, $backcolor); $titlecolor = ImageColorAllocate($im, $bgc[0], $bgc[1], $bgc[2]); $white = ImageColorAllocate($im, 255, 255, 255); $green = ImageColorAllocate($im, 0, 191, 0); $brown = ImageColorAllocate($im, 128, 0, 0); $blue = ImageColorAllocate($im, 0, 0, 255); ImageTTFText($im, $titlesize, $rotation, $offset_x, $offset_y, $titlecolor, $titlefont, $title); ImagePNG($im); ImageDestroy($im); ?> You call it with: <?PHP $title = "TextGoesHere"; echo "<IMG SRC=\"/includes/graftext.php?title=$title&titlecolor=$titlecolor&titlefont=$titlefont&titlesize=$titlesize&rotation=$rotation\" ALT=\"$title\">"; ?> Thanks for any light you can shed on this problem! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17151&edit=1