Jump to content
The Uniform Server Community
Sign in to follow this  
prom3th3an

[GD SUPPORT] Fatal error: Call to undefined function imagecreatefromjpeg()

Recommended Posts

Im running the latest version of Uniform Server. It has the GD2 extension installed and enabled. I used to run XAMPP but was tired of the lack of updates.

 

I have a script that does some image editing based on the GD2 extension that will not work with Uniform Server, but works perfectly fine on XAMPP. Having read around about this issue, it seems to be commonly due to the directives being out of order when PHP was compiled however theres probably other things at play.

 

The error I recieve when I try to run the script is "Fatal error: Call to undefined function imagecreatefromjpeg()" - imagecreatefromjpeg() is part of the GD2 php extension

 

Can you guys please look into this?

 

Ive pasted the GD part of my PHP info.

 

gd
GD Support 	enabled
GD Version 	bundled (2.0.34 compatible)
FreeType Support 	enabled
FreeType Linkage 	with freetype
FreeType Version 	2.3.9
GIF Read Support 	enabled
GIF Create Support 	enabled
JPEG Support 	enabled
libJPEG Version 	6b
PNG Support 	enabled
libPNG Version 	1.2.44
WBMP Support 	enabled
XBM Support 	enabled

Directive	Local Value	Master Value
gd.jpeg_ignore_warning	0	0

Share this post


Link to post
Share on other sites

I ran the following code with no errors:

<?php
header ("Content-type: image/jpeg");
$string = "ABC123465DEF";											 
$font  = 5;
$im = ImageCreateFromjpeg("images/logo.jpg");
$x = 5;
$y = 5;
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 255, 255,0);
imagestring ($im, $font, $x, $y,  $string, $text_color);
imagejpeg ($im);
?> 

 

Ran on a default installation of Nano_5_6_15

 

Can you supply a small code snippet that fails? Or try the above to see I it fails on your machine.

 

All the best

Ric :)

Share this post


Link to post
Share on other sites

Or try the above to see I it fails on your machine.

 

It fails also, Fatal error: Call to undefined function ImageCreateFromjpeg() in C:\Documents an

d Settings\Administrator\Desktop\test.php on line 5

 

 

It fails also, Fatal error: Call to undefined function ImageCreateFromjpeg() in C:\Documents an

d Settings\Administrator\Desktop\test.php on line 5

 

*face palms so hard it leaves a crator* Its always something obvious, in this instance the gd2 extension wasnt being loaded in the php-cli.ini file (but was loaded in php.ini). So it worked for websties (and phpinfo()) but not for command line scripts.

 

Might be worth changing that default ini file to include things such as that extension.

Share this post


Link to post
Share on other sites

Interesting, indeed ... But if you find yourself something to do with php-cli.ini, you may customize to your own needs without "changing that default ini file", e.g., with switch '-c', '-d', et cetera ...

 

 

It fails also, Fatal error: Call to undefined function ImageCreateFromjpeg() in C:\Documents an

d Settings\Administrator\Desktop\test.php on line 5

*face palms so hard it leaves a crator* Its always something obvious, in this instance the gd2 extension wasnt being loaded in the php-cli.ini file (but was loaded in php.ini). So it worked for websties (and phpinfo()) but not for command line scripts.

 

Might be worth changing that default ini file to include things such as that extension.

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...