Forum Moderators: open
I have PHP 4.11, and extension=php_gd2.dll uncommented in php.ini. I do have ACDSee installed and Symantec Antivirus in use which may be causing some interference. My registry entrees seem okay (e.g. "Content-type: image/png").
I must be overlooking something elementary. May I humbly ask if anyone has an idea of what may be the problem?
Thanks very much,
Eugene
<?php
header ("Content-type: image/png");
$img_handle = ImageCreate (230, 40);
$back_color = ImageColorAllocate ($img_handle, 0, 10, 10);
$txt_color = ImageColorAllocate ($img_handle, 233, 114, 191);
ImageString ($img_handle, 31, 5, 5, "This is a simple test of GD", $txt_color);
ImagePng ($img_handle);
?>
I briefly got this to display the correct output yesterday using Localhost, but it then stopped working for no reason I could see (I changed nothing to make it work either, just pressed the "Back" button on IE a couple of times to exit out of other pages). When I tested it on a publicly-hosted site of mine, it worked, but only after I placed "ob_start();" at beginning of code (I got "headers" type errors otherwise).
Thanks
Eugene
Eugene
[localhost...]
where of course "fun2.php" is the name of the code file, which I showed earlier.
Is this what you mean? I double checked the output of phpinfo() and it does show GD to be properly intalled (php_gd2.dll).
Thanks for your patience.
Eugene
'--with-gd=/usr/local'
'--enable-gd-native-ttf'
GD Support.........enabled
GD Version.........1.6.2 or higher
FreeType Support...enabled
FreeType Linkage...with freetype
JPG Support........enabled
PNG Support........enabled
WBMP Support.......enabled
I would double check the installation configuration [us4.php.net] if you can't update your PHP version. But I recommend updating your PHP version, for, among other reasons, there is this NOTE from the manual:
Note: Since PHP 4.3 there is a bundled version of the GD lib. This bundled version has some additional features like alpha blending, and should be used in preference to the external library since it's codebase is better maintained and more stable.
Oh yeah, one last thing, it is probably a good practice to add an imagedestroy [us4.php.net] line to your code to free any memory associated with the image.
Regards,
coopster
Unknown(): gd: Unable to initialize module
Module complied with module API=20010901, debug=0, thread-safety=1, etc.
I presume since the GD library is now integrated in to PHP, one does not need to "manually" incorporate php_gd2.dll? However, unlike you, I did not see a separate GD section when I ran phpinfo(). So something appears to be wrong.
I still have not got my php/GD-generated images to display.
Eugene
I had to alter php.ini slightly, such as commenting out php_gd2.dll, since it gave errors
[us4.php.net...]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. In Windows, you'll include the GD2 DLL php_gd2.dll as an extension in php.ini. The GD1 DLL php_gd.dll was removed in PHP 4.3.2.
I don't think you have your installation/configuration correct yet.
I assume you are still running the test against your local Windows box as opposed to the Linux box and you have updated PHP to 4.3.3 on the Windows box. The PHP Manual has a function reference page dedicated to the Image functions and the User Contributed notes add plenty of detail to help you nail the install and configuration down.
BTW, if you want to enhance GD to handle more image formats and fonts you need to download them. See the Requirements area of the link above.
PHP Warning: gd: Unable to initialize module
Module compiled with module API=20010901, debug=0, thread-safety=1
PHP compiled with module API=20020429, debug=0, thread-safety=1
These options need to match
I don't know what's up. Perhaps mixing of modules from PHP 4.1.1 and 4.3.3 is a problem. I clearly don't have a GD module section in the phpinfo() output (I had GD OK with PHP 4.1.1).
Eugene
On the other hand, I would have more control over compiling/configuring if headed back to linux (RH), which I shall do this weekend if I don't fix this problem.
Eugene
The reason I undertook this monsense of trying to get PHP/GD/MySQL to work under Windows 2000, is that the latter is on my laptop and I could do the necessary programming in the proximity of humankind without retiring to the attic where my Linux/desktop is located (it being the case that I lost the logon PW for my laptop Linux operating system).
Thank you all for your help. I will continue to chase the Windows problem of enabling GD in PHP 4.3.3/gettting images to display. If successful, I will post my findings here.
Cheers,
Eugene