Jump to content

Archived

This topic is now archived and is closed to further replies.

jordanwb

[SOLVED] Call to undefined function imagecreatefromjpeg()

Recommended Posts

I'm trying to use the class given http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php to resize a picture. But when I call the load function I get the error:

 

Fatal error: Call to undefined function imagecreatefromjpeg() in /var/www/photos/system/photo_resize.php on line 31

 

Now I think I have to include some module, but I don't know what to do regarding that.

Share this post


Link to post
Share on other sites

You don't have GD enabled.  If you're using Ubuntu, you need to do:

 

sudo apt-get install php5-gd

 

If you're using Windows, check your PHP.ini for the extension lines and find GD, uncomment it, and restart Apache.

Share this post


Link to post
Share on other sites

sudo apt-get install php5-gd

sudo /etc/init.d/apache2 restart

php5 -m | grep 'gd'

 

But now, there's a catch.  Ubuntu doesn't use the bundled GD library, they actually use the system's GD library, which lacks the imagerotate and imagefilter (and some other) functions.  If you need them, you need to change the package and reconfigure it which can take a good hour or hour and a half because it's a HUGE package.  If you need those functions, send me a PM.

Share this post


Link to post
Share on other sites

Well all I did was install it and restart apache and it works just fine for me.

Share this post


Link to post
Share on other sites

Yeah.  I know.  But you won't have imagerotate or imagefilter and some other functions, trust me.  If you ever need them, contact me.

Share this post


Link to post
Share on other sites

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