From:             
Operating system: linux
PHP version:      5.2.13
Package:          *Graphics related
Bug Type:         Feature/Change Request
Bug description:server in linux

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 bug report at http://bugs.php.net/bug.php?id=51337&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=51337&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=51337&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=51337&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=51337&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=51337&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=51337&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=51337&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=51337&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=51337&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=51337&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=51337&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=51337&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=51337&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=51337&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51337&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51337&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=51337&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=51337&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=51337&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=51337&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=51337&r=mysqlcfg

Reply via email to