libGD

GD is an open source code library for the dynamic creation of images by programmers. GD is written in C, and “wrappers” are available for Perl, PHP and other languages. GD creates PNG, JPEG and GIF images, among other formats. GD is commonly used to generate charts, graphics, thumbnails, and most anything else, on the fly. While not restricted to use on the web, the most common applications of GD involve web site development.

See the GD website for more informations.

Tasklist

FS#125 — JPEG and PNG support missing in php (gd v2.0.33)

Attached to Project — libGD
Opened by Bob Atkins (bobatkins) - Monday, 15 October 2007, 01:18 GMT+2
Last edited by Pierre Joye (Pierre) - Saturday, 17 November 2007, 22:34 GMT+2
Task Type Support Request
Category General
Status Closed
Assigned To No-one
Operating System Other
Severity High
Priority Normal
Reported Version 2.0.35
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

PHP keeps reporting no JPEG and PNG support yet gd configure confirms jpeg and png support and gdlib-config –features also shows that both have been included. ldd check against libgd.so also shows that the jpeg and png libs are linked in. Any help insolving this mystery would be greatly appreciated.

** Configuration summary for gd 2.0.33:

 Support for PNG library:          yes
 Support for JPEG library:         yes
 Support for Freetype 2.x library: yes
 Support for Fontconfig library:   no
 Support for Xpm library:          yes
 Support for pthreads:             yes

php -info

gd

GD Support ⇒ enabled GD Version ⇒ 2.0 or higher FreeType Support ⇒ enabled FreeType Linkage ⇒ with freetype FreeType Version ⇒ 2.2.1 T1Lib Support ⇒ enabled GIF Read Support ⇒ enabled GIF Create Support ⇒ enabled WBMP Support ⇒ enabled

I have confirmed that php is not using the bundled gd.

% gdlib-config –features GD_XPM GD_JPEG GD_FREETYPE GD_PNG GD_GIF

% ldd /opt/lib/libgd.so

libXpm.so.4 =>	 /opt/lib/libXpm.so.4
libX11.so.4 =>	 /usr/lib/libX11.so.4
libjpeg.so.62 =>	 /opt/lib/libjpeg.so.62
libfreetype.so.6 =>	 /opt/lib/libfreetype.so.6
libpng12.so.0 =>	 /opt/lib/libpng12.so.0
libz.so =>	 /opt/lib/libz.so
libm.so.1 =>	 /usr/lib/libm.so.1
libc.so.1 =>	 /usr/lib/libc.so.1
libgcc_s.so.1 =>	 /opt/lib/libgcc_s.so.1
libXext.so.0 =>	 /usr/openwin/lib/libXext.so.0
libsocket.so.1 =>	 /usr/lib/libsocket.so.1
libnsl.so.1 =>	 /usr/lib/libnsl.so.1
libdl.so.1 =>	 /usr/lib/libdl.so.1
libmp.so.2 =>	 /usr/lib/libmp.so.2
/usr/platform/SUNW,UltraSPARC-IIi-Engine/lib/libc_psr.so.1
This task depends upon

Closed by  Pierre Joye (Pierre)
Saturday, 17 November 2007, 22:34 GMT+2
Reason for closing:  Not a bug
Additional comments about closing:  Looks like no further info will be provided. Feel free to reopen this bug or add a comment if you have more details.
Comment by Bob Atkins (bobatkins) - Monday, 15 October 2007, 01:19 GMT+2

Yes, I have read the FAQ regarding this issue and done what it says... No joy.

Comment by Pierre Joye (Pierre) - Monday, 15 October 2007, 19:24 GMT+2
  • Field changed: Status (Unconfirmed → Waiting on Customer)

How did you compile PHP? Please copy the configure line here.

Comment by Bob Atkins (bobatkins) - Monday, 15 October 2007, 20:10 GMT+2

PHP 5.2.0 has been built with the following configuration:

./configure' '–prefix=/opt' '–with-mod_charset' '–with-pear' '–with-config-file-path=/opt/etc' '–with-apxs2=/opt/apache2/bin/apxs' '–with-mysql=/opt' '–with-mcrypt=/opt' '–with-openssl=/opt' '–with-openssl-dir=/opt' '–with-libxml-dir=/opt' '–with-imap=/opt/imap' '–with-imap-ssl=/opt/ssl' '–with-zlib=/opt' '–with-zlib-dir=/opt' '–with-bz2=/opt' '–with-gd=/opt' '–enable-gd-native-ttf' '–with-jpeg-dir=/opt' '–with-png-dir=/opt' '–with-xpm-dir=/opt' '–with-ttf' '–with-freetype-dir=/opt' '–with-t1lib=/opt' '–with-ncurses=/opt' '–with-curl=/opt' '–with-gettext=/opt' '–with-xsl=/opt' '–enable-bcmath' '–enable-calendar' '–enable-wddx' '–enable-shmop' '–enable-sysvmsg' '–enable-sysvsem' '–enable-sysvshm' '–enable-cli' '–enable-mbstring' '–enable-soap' '–enable-track-vars' '–enable-memory-limit' '–enable-static=no' '–enable-fastcgi' '–enable-dba' '–enable-exif' '–enable-ftp' '–disable-debug' '–disable-rpath'

Comment by Pierre Joye (Pierre) - Saturday, 20 October 2007, 10:02 GMT+2

Please compile php using:

...’–with-gd’ ...

and try again.

Comment by Pierre Joye (Pierre) - Saturday, 20 October 2007, 10:04 GMT+2

Btw, you may seriously consider to upgrade to a recent PHP version (5.2.4 for example). 5.2.0 contains many security issues.

Comment by Bob Atkins (bobatkins) - Saturday, 20 October 2007, 10:20 GMT+2

php is already compiled '-with-gd=/opt'. Please check my posted php configuration above to confirm.

gd is working with php and gdtest.php reports:

GD is supported by your server!

GD Version Yes
FreeType Support Yes
FreeType Linkage Yes
T1Lib Support Yes
GIF Read Support Yes
GIF Create Support Yes
JPG Support No
PNG Support No
WBMP Support Yes
XPM Support No
XBM Support No
JIS-mapped Japanese Font Support No
Comment by Bob Atkins (bobatkins) - Saturday, 20 October 2007, 10:22 GMT+2

Thank you for the advise regarding upgrading php to a later version. Unfortunately, there is always a reason to upgrade but we cannot be constantly chasing the latest version. There were also some very bad releases after 5.2.0 and some very good reasons not to upgrade.

Comment by Pierre Joye (Pierre) - Tuesday, 23 October 2007, 14:33 GMT+2

I still strongly recommend to upgrade to 5.2.4 but that does not change the fact: you should compile using: '–with-gd'. Please try with this option.

Comment by Bob Atkins (bobatkins) - Tuesday, 23 October 2007, 21:34 GMT+2

'-with-gd' and 'with-gd=/opt' are equivalent to enable the gd option. I must use '-with-gd=/opt' or the gd libraries which are in /opt/lib will not be found.

I think I have very clearly shown that gd has been built into php and specifically the JPG and PNG image support is not working. Wasting my time recompiling with just '-with-gd' will not prove anything as the build will fail by not finding the gd libs in /opt/lib and building php 5.2.4 isn't likely going to fix anything either.

When I figure out the solution I'll be sure to keep it to myself.

Comment by Pierre Joye (Pierre) - Tuesday, 23 October 2007, 21:57 GMT+2
'-with-gd' and 'with-gd=/opt' are equivalent to enable the gd option. I must use '-with-gd=/opt' or the gd libraries which are in /opt/lib will not be found.

They are not equivalent. One will use the external library (and disable almost all new features in php-gd since 4.3.0) and the other ("–with-gd") will enable the bundled library.

I think I have very clearly shown that gd has been built into php and specifically the JPG and PNG image support is not working. Wasting my time recompiling with just '-with-gd' will not prove anything as the build will fail by not finding the gd libs in /opt/lib and building php 5.2.4 isn't likely going to fix anything either.

I'm sorry but you missed my point. As I can understand why you don't want to upgrade PHP, you should consider two things:

  • PHP has a bundled library which I maintain as well with much more features and bug fixes (from a php or gd point of view) than the external version
  • gd 2.0.33 is outdated and unsecure, at least consider our latest release

As the maintainer of the PHP GD extension and its bundled library and the libgd library (libgd.org), I strongly suggest you to use the "–with-gd" option.

When I figure out the solution I'll be sure to keep it to myself.

Sure but you are missing my goal: trying to help you to get php working.

Now about your problem, I don't have a sun to test a build. Have you installed the libpng and libjpeg development package and/or are the headers available in the default location when you compiled php?

Loading...