Post by whoknows » Thu May 10, 2007 9:36 am

Hello,
I receive this error on installation for the main site. The admin area seems to work but the store front only displays this:

Fatal error: Call to undefined function imagecreatefromjpeg() in /.../.../htdocs/en_US/opencart/include/image.php on line 59

Any help is greatly appreciated. Thank you.

Newbie

Posts

Joined
Thu May 10, 2007 9:34 am

Post by Daniel » Thu May 10, 2007 3:16 pm

you need to enable GD support in your php.ini.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by whoknows » Thu May 10, 2007 9:37 pm

Hi Daniel,
Yes, I do have it installed. Here is the info from doing a: php phpinfo()


===============================================

gd
GD Support enabled
GD Version bundled (2.0.34 compatible)
GIF Read Support enabled
GIF Create Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
Last edited by whoknows on Thu May 10, 2007 9:40 pm, edited 1 time in total.

Newbie

Posts

Joined
Thu May 10, 2007 9:34 am

Post by Daniel » Fri May 11, 2007 12:14 am

imagecreatefromjpeg is a built in function or php.

More details here:

http://hk2.php.net/manual/en/function.i ... omjpeg.php

Is your PHP version 4 or greater?
Last edited by Daniel on Fri May 11, 2007 12:16 am, edited 1 time in total.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by whoknows » Fri May 11, 2007 2:00 am

Yes, I am using a version 5.1

Newbie

Posts

Joined
Thu May 10, 2007 9:34 am

Post by Daniel » Fri May 11, 2007 2:13 am

I have not actually come accorss this problem before.

What version of GD do you have?

The only information I could find was this:
Note: JPEG support is only available if PHP was compiled against GD-1.8 or later.
If imagecreatefromjpeg() fails with "PHP Fatal error:  Call to undefined function:  imagecreatefromjpeg()", it does NOT necessarily mean that you don't have GD installed.

If phpinfo() shows GD, but not JPEG support, then that's the problem.  You would think that --with-gd would do the right thing since it does check for the existance of libjpeg (and finds it) and add that feature to GD, but it doesn't in v4.4.4 at least on RHEL v2.1, RHEL v3, CentOS v2.1 or CentOS v4.3.

On those platforms, it's *important* that --with-jpeg-dir be *before* --with-gd.  If it's not, GD won't build with jpeg support as if --with-jpeg-dir had never been specified...
I've found a bug in CentOS 4.x that, while previously addressed, does not seem to be directly addressed here as far as the nature of the bug is concerned.

If you are having a problem getting this function to work on CentOS 4.4 (may appear earlier) and are receiving this error:

Call to undefined function imagecreatefromjpeg()

This is because the installation *does* support JPG by default if you have libjpeg installed. However, the config script finds libjpeg in /usr/lib but it is never successfully added to the PHP build.

To fix this, you should recompile PHP and be absolutely sure to add '--with-jpeg-dir' to the config command. This should appear BEFORE the --with-gd option. Example:

'--with-jpeg-dir' '--with-gd'

If you don't put it before --with-gd, the option is completely ignored.

As always, be sure to do a 'make clean' before a 'make install'. I made the mistake of forgetting to check and wasted 30 minutes trying to resolve this problem simply because I forgot to clean up after myself previously.
If you are running PHP 5.1 i this should work.
Last edited by Daniel on Fri May 11, 2007 2:15 am, edited 1 time in total.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by whoknows » Fri May 11, 2007 2:24 am

I am recompiling php now with the jpd-dir flag. hopefully this fixes it.

Newbie

Posts

Joined
Thu May 10, 2007 9:34 am

Post by whoknows » Sun May 13, 2007 10:07 am

Well, the recompile did fix it. Thank you for pointing me to the suggested fix. I am hoping to build my store shortly.

Newbie

Posts

Joined
Thu May 10, 2007 9:34 am
Who is online

Users browsing this forum: No registered users and 4 guests