Jump to content
View in the app

A better way to browse. Learn more.

The Uniform Server Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

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

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 :)

  • Author

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.

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.

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...

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.