|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-03-17 20:55 UTC] administrateur at exinsidephp dot com
Description: ------------ Hi, I have ugraded PHP 5.2 to PHP 5.3.2 on my Debian server and I have found a bug width ths function imagettfbbox. Sometimes the text don't show on the image generated : http://www.exinsidephp.com/cache/example.png If I refresh the page (Ctrl+F5) another image don't display the text : http://www.exinsidephp.com/cache/example2.png Any error on PHP Blog, any error on syslog or kernel log... I haven't find any trace of error. Someone have the same issue ? The PHP Package come from http://www.dotdeb.org/ website. The list of modules installed (dpkg -l | grep php5) : ii libapache2-mod-php5 5.3.2-0.dotdeb.1 ii php5 5.3.2-0.dotdeb.1 ii php5-cli 5.3.2-0.dotdeb.1 ii php5-common 5.3.2-0.dotdeb.1 ii php5-curl 5.3.2-0.dotdeb.1 ii php5-dev 5.3.2-0.dotdeb.1 ii php5-gd 5.3.2-0.dotdeb.1 ii php5-geoip 5.3.2-0.dotdeb.1 ii php5-imagick 5.3.2-0.dotdeb.1 ii php5-imap 5.3.2-0.dotdeb.1 ii php5-mcrypt 5.3.2-0.dotdeb.1 ii php5-mysql 5.3.2-0.dotdeb.1 ii php5-suhosin 5.3.2-0.dotdeb.1 ii php5-xcache 5.3.2-0.dotdeb.1 Test script: --------------- header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); header('Content-Type: image/png'); $image = imagecreate(55,15); imagecolorallocate($image, 0,0,0); if($get->getValue('temp2')) $texte = $get->getValue('temp1').'/'.$get->getValue('temp2').' °C'; else $texte = $get->getValue('temp1').' °C'; $tab = imagettfbbox(8,0,Config::getCons('PATH_CACHE').'font/verdana.TTF', $texte); $text_x = (55-($tab[2]-$tab[6]))/2; $text_y = (15-($tab[1]-$tab[5]))/2+9; //$color = imagecolorallocate($image, 2,119,186); $color = imagecolorallocate($image, 255,255,255); imagettftext($image,8,0,$text_x,$text_y,$color,Config::getCons('PATH_CACHE').'font/verdana.TTF',$texte); imagepng($image); PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 11:00:01 2025 UTC |
So I have add debug line and i find origin of bug : View my previous script an modify width this line : $tab = imagettfbbox(8,0,Config::getCons('PATH_CACHE').'font/verdana.TTF', $texte); $text_x = (55-($tab[2]-$tab[6]))/2; $text_y = (15-($tab[1]-$tab[5]))/2+9; file_put_contents(Config::getCons('PATH_CACHE').'log_font.txt', $text.' x:'.$text_x.' y:'.$text_y.' imagbox:'.json_encode($tab)."\n",FILE_APPEND); The result : x:12 y:12.5 imagbox:[-1,-1,30,-1,30,-9,-1,-9] x:33554459 y:12.5 imagbox:[-1,-1,-33554433,-1,-33554433,-9,33554430,-9] x:33554459 y:12.5 imagbox:[-1,-1,-33554433,-1,-33554433,-9,33554430,-9] x:33554459 y:12.5 imagbox:[-1,-1,-33554433,-1,-33554433,-9,33554430,-9] x:12 y:12.5 imagbox:[-1,-1,30,-1,30,-9,-1,-9] x:12 y:12.5 imagbox:[-1,-1,30,-1,30,-9,-1,-9] x:12 y:12.5 imagbox:[-1,-1,30,-1,30,-9,-1,-9] x:12 y:12.5 imagbox:[-1,-1,30,-1,30,-9,-1,-9] x:12 y:12.5 imagbox:[-1,-1,30,-1,30,-9,-1,-9] x:12 y:12.5 imagbox:[-1,-1,30,-1,30,-9,-1,-9] x:33554459 y:12.5 imagbox:[-1,-1,-33554433,-1,-33554433,-9,33554430,-9] x:12 y:12.5 imagbox:[-1,-1,30,-1,30,-9,-1,-9] So the problem is located on imagettfbbox funtion, it give wrong value for x position.