diff options
| author | Pierre Joye <pajoye@php.net> | 2008-11-06 10:23:52 +0000 |
|---|---|---|
| committer | Pierre Joye <pajoye@php.net> | 2008-11-06 10:23:52 +0000 |
| commit | a5368aeb7362d9135e5462d478d3631afccd44d1 (patch) | |
| tree | e74e708d6cb56dd3dd60c7bd17a1d5aa39320cec | |
| parent | 35a632c14b8163764d570e27836935c895cdaceb (diff) | |
| download | php-git-a5368aeb7362d9135e5462d478d3631afccd44d1.tar.gz | |
- MFH:
- Fix linux build (static)
- add gd[Format]Version[Int|String] first methods to work around the png
header issues
| -rw-r--r-- | ext/gd/gd.c | 20 | ||||
| -rw-r--r-- | ext/gd/libgd/gd.h | 3 | ||||
| -rw-r--r-- | ext/gd/libgd/gd_jpeg.c | 5 | ||||
| -rw-r--r-- | ext/gd/libgd/gd_png.c | 5 |
4 files changed, 25 insertions, 8 deletions
diff --git a/ext/gd/gd.c b/ext/gd/gd.c index dc53a349ea..4c051a13d6 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -29,11 +29,6 @@ #include "config.h" #endif -#ifdef HAVE_GD_PNG -/* needs to be first */ -#include <png.h> -#endif - #include "php.h" #include "php_ini.h" #include "ext/standard/head.h" @@ -60,6 +55,15 @@ #if HAVE_LIBGD +#ifdef HAVE_GD_PNG +/* needs to be first */ +# include <png.h> +#endif + +#ifdef HAVE_GD_JPG +# include <jpeglib.h> +#endif + static int le_gd, le_gd_font; #if HAVE_LIBT1 #include <t1lib.h> @@ -1328,15 +1332,15 @@ PHP_MINFO_FUNCTION(gd) #endif #ifdef HAVE_GD_JPG { - char tmp[256]; - snprintf(tmp, sizeof(tmp), "%d", JPEG_LIB_VERSION); + char tmp[12]; + snprintf(tmp, sizeof(tmp), "%d", gdJpegGetVersionInt()); php_info_print_table_row(2, "JPG Support", "enabled"); php_info_print_table_row(2, "libJPEG Version", tmp); } #endif #ifdef HAVE_GD_PNG php_info_print_table_row(2, "PNG Support", "enabled"); - php_info_print_table_row(2, "libPNG Version", PNG_LIBPNG_VER_STRING); + php_info_print_table_row(2, "libPNG Version", gdPngGetVersionString()); #endif php_info_print_table_row(2, "WBMP Support", "enabled"); #if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) diff --git a/ext/gd/libgd/gd.h b/ext/gd/libgd/gd.h index d51f0a88c6..dfadeeb7d7 100644 --- a/ext/gd/libgd/gd.h +++ b/ext/gd/libgd/gd.h @@ -246,6 +246,9 @@ gdImagePtr gdImageCreateFromWBMPCtx(gdIOCtx *infile); gdImagePtr gdImageCreateFromJpeg(FILE *infile, int ignore_warning); gdImagePtr gdImageCreateFromJpegCtx(gdIOCtx *infile, int ignore_warning); +int gdJpegGetVersionInt(); +const char * gdPngGetVersionString(); + /* A custom data source. */ /* The source function must return -1 on error, otherwise the number of bytes fetched. 0 is EOF, not an error! */ diff --git a/ext/gd/libgd/gd_jpeg.c b/ext/gd/libgd/gd_jpeg.c index 9573c1cf69..a71469137f 100644 --- a/ext/gd/libgd/gd_jpeg.c +++ b/ext/gd/libgd/gd_jpeg.c @@ -102,6 +102,11 @@ static void fatal_jpeg_error (j_common_ptr cinfo) exit (99); } +int gdJpegGetVersionInt() +{ + return JPEG_LIB_VERSION; +} + /* * Write IM to OUTFILE as a JFIF-formatted JPEG image, using quality * QUALITY. If QUALITY is in the range 0-100, increasing values diff --git a/ext/gd/libgd/gd_png.c b/ext/gd/libgd/gd_png.c index 7591dc0c67..e15ede73cc 100644 --- a/ext/gd/libgd/gd_png.c +++ b/ext/gd/libgd/gd_png.c @@ -36,6 +36,11 @@ ---------------------------------------------------------------------------*/ +const char * gdPngGetVersionString() +{ + return PNG_LIBPNG_VER_STRING; +} + #ifndef PNG_SETJMP_NOT_SUPPORTED typedef struct _jmpbuf_wrapper { |
