Edit report at http://bugs.php.net/bug.php?id=51337&edit=1
ID: 51337 Updated by: ka...@php.net Reported by: sapin at 3aces dot in Summary: server in linux -Status: Open +Status: Bogus Type: Feature/Change Request Package: *Graphics related Operating System: linux PHP Version: 5.2.13 New Comment: . Previous Comments: ------------------------------------------------------------------------ [2010-03-20 13:15:39] sapin at 3aces dot in Description: ------------ imagettfbbox() function not working in server Test script: --------------- class CaptchaSecurityImages { public $font; public $code; //function CaptchaSecurityImages($width='120',$height='40',$characters='6') { function __construct() { $code = $this->generateCode(6); $font_size = 40 * 0.75; $image = @imagecreate(120, 40) or die('Cannot initialize new GD image stream'); $background_color = imagecolorallocate($image, 255, 255, 255); $text_color = imagecolorallocate($image, 20, 40, 100); $noise_color = imagecolorallocate($image, 100, 120, 180); for( $i=0; $i<(120*40)/3; $i++ ) { imagefilledellipse($image, mt_rand(0,120), mt_rand(0,40), 1, 1, $noise_color); } for( $i=0; $i<(120*40)/150; $i++ ) { imageline($image, mt_rand(0,120), mt_rand(0,40), mt_rand(0,120), mt_rand(0,40), $noise_color); } $font_family= "arial.ttf"; echo "Hai"; $textbox = @imagettfbbox($font_size, 0, $font_family, $code) or die('Error in imagettfbbox function'); imagettftext($image, 20, 0, 11, 21, imagecolorallocate($image, 128, 128, 128), 20, "dggdfg"); $x = ($width - $textbox[4])/2; $y = ($height - $textbox[5])/2; imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font , $code) or die('Error in imagettftext function'); header('Content-Type: image/jpeg'); imagejpeg($image); imagedestroy($image); $_SESSION['security_code'] = $code; } function generateCode($characters) { $possible = '23456789bcdfghjkmnpqrstvwxyz'; $code = ''; $i = 0; while ($i < $characters) { $code .= substr($possible, mt_rand(0, strlen($possible)-1), 1); $i++; } return $code; } } $width = isset($_GET['width']) ? $_GET['width'] : '120'; $height = isset($_GET['height']) ? $_GET['height'] : '40'; $characters = isset($_GET['characters']) && $_GET['characters'] > 1 ? $_GET['characters'] : '6'; $captcha = new CaptchaSecurityImages(); Expected result: ---------------- server version problem Actual result: -------------- I dont know ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51337&edit=1