Jump to content

Enable Image Function in PHP


Recommended Posts

This manual entry covers the subject.

 

Thank you for your support. But I already went through all that manuals at php.net. I'm confused on what kind of lines I should add to php.ini. I saw another forum saying that I have to add an extension in php.ini and I downloaded "php_gd2.dll" file and copied inside \PHP\ext folder and I added "etension=php_gd2.dll" line in php.ini and restarted IIS but no luck with that.

 

Do I have to add a line like "--with-gd

[php_gd2.dll]" in php.ini?

They are also talking about a GD bundle. Where can I find the bundle for Windows? I only saw bundles for Linux and installation help for Linux. But I had no luck finding any manuals for Windows.

When I execute the following command, it gives me HTTP 500 Internal Server Error. Is that because of GD?

Code:
<?php
header ("Content-type: image/png");
$im = @imagecreatetruecolor(120, 20)
      or die("Cannot Initialize new GD image stream");
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
?> 

 

Any help really appreciated!

 

Thank you.

Link to comment
Share on other sites

I'm not a windows user but as far as I'm aware most extensions are bundled already into the windows package. You simply need to enable them via the php.ini.

 

Do I have to add a line like "--with-gd[php_gd2.dll]" in php.ini?

 

No, that is a compile time option used when building php from source on *nix based systems.

 

Sorry, but a windows user will hoepfully come allong soon and provide further assistance.

Link to comment
Share on other sites

[but I already went through all that manuals at php.net. I'm confused on what kind of lines I should add to php.ini. I saw another forum saying that I have to add an extension in php.ini and I downloaded "php_gd2.dll" file and copied inside \PHP\ext folder and I added "etension=php_gd2.dll" line in php.ini and restarted IIS but no luck with that.

When PHP is installed on Windows, the extensions your use must be of same version of PHP installed. For example if you have PHP5.2.6 installed but the extension you downloaded is for PHP5.2.4 it wont work. The build version has to be PHP5.2.6. You can tell the version of extension by looking at the file in windows explorer, it'll display the file name and then beneath it'll show the version number.

 

You should also make sure the extension_dir directive points to PHP's extension folder, eg

extension_dir = "C:/PHP/ext"

 

You do not need to do any recompiling on Windows.

Link to comment
Share on other sites

[but I already went through all that manuals at php.net. I'm confused on what kind of lines I should add to php.ini. I saw another forum saying that I have to add an extension in php.ini and I downloaded "php_gd2.dll" file and copied inside \PHP\ext folder and I added "etension=php_gd2.dll" line in php.ini and restarted IIS but no luck with that.

When PHP is installed on Windows, the extensions your use must be of same version of PHP installed. For example if you have PHP5.2.6 installed but the extension you downloaded is for PHP5.2.4 it wont work. The build version has to be PHP5.2.6. You can tell the version of extension by looking at the file in windows explorer, it'll display the file name and then beneath it'll show the version number.

 

You should also make sure the extension_dir directive points to PHP's extension folder, eg

extension_dir = "C:/PHP/ext"

 

You do not need to do any recompiling on Windows.

 

Thank you for your advice. I just saw that my PHP version is 5.2.4.4 and php_gd2.dll version is 5.1.7.7. So does that mean if I get the right version of php_gd2.dll which should be 5.2.4.4, is it the only file which PHP requires to enable image function in Windows or do I have to include more extensions to enable image support?

 

Thanks in advance!

Link to comment
Share on other sites

If you have PHP5.2.4 installed, then you need to that release from the PHP archives, download the windows binary version here. Open the zip and extract php_gd2.dll from the ext folder and place it in your PHP ext folder

 

EDIT: You'll also need gds32.dll this file comes in the download too, move it where php.exe is

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.