Tips for Windows User to Set up GD(dynamic graphic lib) with PHP.
Problem I meet:
When i run following function, which terminates at
$img = @imagecreatefromjpeg($image_path);
error message is : undefined function imagecreatefromjpeg();
no other code of the script gets executed.
Solution:
In one word, you need to turn on gd lib,
which hold the implementation of imagecreatefromjpeg();
please follow below steps:
my php install dir is: c:/php/
first you must try to find:
c:/php/php.ini
c:/php/ext/php_gd2.dll(php 5)
c:/php/extension/php_gd2.dll(php 4)
The php_gd2.dll is included in a standard PHP installation for Windows,
however, it's not enabled by default.
You have to turn it on,
You may simply uncomment the line "extension=php_gd2.dll" in php.ini and restart the PHP extension.
Change:
,extension=php_gd2.dll
To:
extension=php_gd2.dll
You may also have to correct the extension directory setting
from:
extension_dir = "./"
extension_dir = "./extensions"
To (FOR WINDOWS):
extension_dir = "c:/php/extensions"(php 4)
extension_dir = "c:/php/ext"(php 5)
Cheers!