note 21761 added to function.imagecreatetruecolor

From: Date: Sat, 25 May 2002 18:26:32 +0000
Subject: note 21761 added to function.imagecreatetruecolor
Groups: php.notes 
Request: Send a blank email to php-notes+get-31033@lists.php.net to get a copy of this message
I came up with this today. You need GD2.0 or greater to use imagecreatetruecolor so you can parse phpinfo to get the needed information. this will have to go at the very top of the page with no whitespace above it <?php ob_start(); phpinfo(8); $phpinfo=ob_get_contents(); ob_end_clean(); $phpinfo=strip_tags($phpinfo); $phpinfo=stristr($phpinfo,"gd version"); $phpinfo=stristr($phpinfo,"version"); $end=strpos($phpinfo," "); $phpinfo=substr($phpinfo,0,$end); $phpinfo=substr($phpinfo,7); if(version_compare("2.0", "$phpinfo")==1) echo "you have a version less then 2"; ?> The if statement is for PHP 4.1 or greater, but you can use other methods of comparing the version numbers if the server you are on do not have that version of php -- http://www.php.net/manual/en/function.imagecreatetruecolor.php http://master.php.net/manage/user-notes.php?action=edit+21761 http://master.php.net/manage/user-notes.php?action=delete+21761 http://master.php.net/manage/user-notes.php?action=reject+21761

« previous php.notes (#31033) next »