note 28470 added to function.imagecreatetruecolor

From: Date: Tue, 14 Jan 2003 11:26:24 +0000
Subject: note 28470 added to function.imagecreatetruecolor
Groups: php.notes 
Request: Send a blank email to php-notes+get-42115@lists.php.net to get a copy of this message
Because imagecreatetruecolor exist both in gd and gd2, you can't use function_exists or get_extension_funcs to check for gd2 ! But ... there is a difference in imagettfbbox between gd and gd2: gd use pixels and gd2 use points. Then you can check gd2 with this function: function sysB_chkgd2() { $rep=false; if(isset($GLOBALS["gBGDVersion"])) { $rep=$GLOBALS["gBGDVersion"]; } else { if(function_exists("gd_info")) { $gdver=gd_info(); if(strstr($gdver["GD Version"],"1.")!=false) { $rep=false; } else { $rep=true; } } else { $size=40; $font= your font file path here; $b=imagettfbbox ($size,0,$font,"abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ"); if(($size+1)<abs($b[5]-$b[3])) { $rep=true; } } $GLOBALS["gBGDVersion"]=$rep; } return $rep; } -- http://www.php.net/manual/en/function.imagecreatetruecolor.php http://master.php.net/manage/user-notes.php?action=edit+28470 http://master.php.net/manage/user-notes.php?action=delete+28470 http://master.php.net/manage/user-notes.php?action=reject+28470

« previous php.notes (#42115) next »