Forum Moderators: coopster
phpinfo(); produces...
Configure Command:
'./configure' '--with-config-file-path=/etc' '--with-mysql=/usr/local/mysql' '-enable-ftp' '--enable-bcmath' '--disable-debug' '--with-gd=/usr/local/gd2' '--with-gd-native-ttf' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr' '--with-zlib=/usr' '--with-imap=../imap-2001a' '--with-apxs=/usr/local/apache/sbin/apxs' '--with-freetype-dir=/usr/local/freetype' '--with-ttf' '--with-openssl-dir=/usr/local/openssl' '--with-curl' '--with-pear' '--enable-mbstring' '--with-calendar=shared' '--enable-memory-limit' '--enable-magic-quotes' '--enable-wddx'
'--with-mhash' '--with-kerberos' '--with-dom=/usr/local/xml2'
GD:
GD Support enabled
GD Version 2.0 or higher
FreeType Support enabled
FreeType Linkage with freetype
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
<snipped urls>
image uploaded in binary mode, php file in ascii
<?php
header("Content-type: image/png");
$string = 'testdddddddddddddddddd';
$im = imagecreatefrompng("imager.png");
$orange = imagecolorallocate($im, 220, 210, 60);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, 9, $string, $orange);
imagepng($im);
imagedestroy($im);
?>
[edited by: coopster at 1:45 pm (utc) on June 23, 2006]
[edit reason] removed urls per TOS [webmasterworld.com] [/edit]
The code looks fine and I tested it on both a Windows server and on a *nix server without issue. Have you tried turning up your error_reporting() [php.net] to see if you are receiving any errors or have you checked your server logs for any errors?
To enable GD-support configure PHP--with-gd[=DIR], where DIR is the GD base install directory. To use the recommended bundled version of the GD library (which was first bundled in PHP 4.3.0), use the configure option--with-gd. GD library requires libpng and libjpeg to compile.
Maybe try recompiling, taking careful note of installation instructions? I don't know where else to advise right now except this route as the code looks correct.
Try this to see what you get:
var_dump(gd_info());
var_dump(gd_info());
reasulted in:
array(11) {
["GD Version"]=>
string(13) "2.0 or higher"
["FreeType Support"]=>
bool(true)
["FreeType Linkage"]=>
string(13) "with freetype"
["T1Lib Support"]=>
bool(false)
["GIF Read Support"]=>
bool(true)
["GIF Create Support"]=>
bool(true)
["JPG Support"]=>
bool(true)
["PNG Support"]=>
bool(true)
["WBMP Support"]=>
bool(true)
["XBM Support"]=>
bool(false)
["JIS-mapped Japanese Font Support"]=>
bool(false)
}