logo
Apache Lounge
Webmasters

 


About

Forum Index Downloads Search Register Log in  RSS Apache Lounge
 



Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Apache Lounge is not sponsored.

Your donations will help to keep this site alive and well, and continuing building binaries.



About using GD library

 
Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner



View previous topic :: View next topic  
Author Message
aabdi406



Joined: 27 Mar 2008
Posts: 2

PostPosted: Thu 27 Mar '08 6:42    Post subject: About using GD library Reply with quote

Hi all,


I am having a problem using the GD library, I am using XAMPP that installs apache,php, mysql, perl... in one go. when I go phpinfo() it says the GD is enabled and the php.ini is pointing to correct extension directory but when I run the code it is coming up with error below:


- Call to undefined function imagecreatefromjpeg()

here is the script that I am trying to run"



Code:


$src_image = '_Images/img004.jpeg';
$imgWidth = 750;
$imgHeight = 502;

$orig = imagecreatefromjpeg($src_image);
$imgProps = getimagesize($src_image);
$imgthumb = imagecreatetruecolor($imgWidth,$imgHeight);


imgecopyresampled($imgthumb,$orig,0,0,0,0,$imgWidth,$imgHeight,$imgProps[0],$imgProps[1]);
header ( "Content-type: image/jpeg" );

imagejpeg ($imgthumb);


 




also phpinfo() it saying " --with-gd=shared " I cann't realy find out a way to get around it.


I wellcome any suggestion that leads to solution of the problem.

Kind Regards

Ab
Back to top
bentogoa



Joined: 09 Feb 2007
Posts: 66
Location: GOA

PostPosted: Thu 27 Mar '08 7:36    Post subject: Reply with quote

Which version of gd are you using?

i tried your script and its working fine.

found a mistake imgecopyresampled should be imagecopyresampled.

Code:

$src_image = 'image.jpg';
$imgWidth = 750;
$imgHeight = 502;

$orig = imagecreatefromjpeg($src_image);
$imgProps = getimagesize($src_image);
$imgthumb = imagecreatetruecolor($imgWidth,$imgHeight);


imagecopyresampled($imgthumb,$orig,0,0,0,0,$imgWidth,$imgHeight,$imgProps[0],$imgProps[1]);
header ( "Content-type: image/jpeg" );

imagejpeg ($imgthumb);


Open you php.ini file and see if
Code:
extension=php_gd2.dll
line is there. If it is here with the semi-colon remove the semi-colon.

Bento Fernandes
http://www.goanwap.com
Webmaster
Back to top
aabdi406



Joined: 27 Mar 2008
Posts: 2

PostPosted: Thu 27 Mar '08 13:48    Post subject: Reply with quote

Thanks bentogoa,


extension=php_gd2.dll is uncommented and it isn't recognising the
the following function and I don't know why it is showing " --with-gd=shared "

Code:

magecreatefromjpeg
 
Back to top
bentogoa



Joined: 09 Feb 2007
Posts: 66
Location: GOA

PostPosted: Thu 27 Mar '08 16:07    Post subject: Reply with quote

I think all php versions downloaded from php.net have that
Code:
--with-gd=shared

even mine have that.

Regarding imagecreatefromjpeg()
Is your extension dir pointed correctly?
check php.ini fro this line, must have the ending slash.

Quote:
extension_dir = "F:/php/ext/"


Are you able to load other extensions?
Which php / apache version are you using ?


Bento Fernandes
http://www.goanwap.com
Webmaster
Back to top


Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner
Page 1 of 1