undefined function: imagecreatefromjpeg()

undefined function: imagecreatefromjpeg()

by Mohd Radzi Abdul Kadir -
Number of replies: 3
When I try to edit user profile I get an error msg "Fatal error: Call to undefined function: imagecreatefromjpeg() in moodle/user/edit.php on line 65"

Any idea why?
Average of ratings: -
In reply to Mohd Radzi Abdul Kadir

Re: undefined function: imagecreatefromjpeg()

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Your PHP server doesn't have GD installed.

Go to your admin "Configure variables" page and check the default setting for GD there ... it will probably say "GD is not installed".

You need to recompile/reinstall PHP with GD support.

This reminds me to add an error check for that case on the user profile page.

Cheers,
Martin
In reply to Martin Dougiamas

Re: undefined function: imagecreatefromjpeg()

by Mohd Radzi Abdul Kadir -
I already install GD now and I still get the same error msg.

In my phpinfo I get
GD Support -enabled
GD Version -between 1.3 and 1.6.1
GIF Read Support -enabled
GIF Create Support -enabled

In reply to Mohd Radzi Abdul Kadir

Re: undefined function: imagecreatefromjpeg()

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
When compiling PHP, in addition to --with-gd, you also need --with-jpeg-dir to include the JPEG libraries (and --with-png-dir for PNG support).

Just in case it's helpful, this is my full PHP configure line on a Redhat server:

./configure --with-gd=/usr --with-jpeg-dir=/usr --with-png-dir=/usr --with-mysql --with-pgsql=/usr --enable-track-vars --enable-trans-sid --with-ttf --with-zlib-dir=/usr --with-xpm-dir=/usr/X11R6 --with-freetype-dir=/usr --with-apxs=/opt/bin/apxs

Cheers,
Martin