Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Zend/Optimizer/zend_func_infos.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,7 @@ static const func_info_t func_infos[] = {
F1("imagecreatefromgd", MAY_BE_OBJECT|MAY_BE_FALSE),
F1("imagecreatefromgd2", MAY_BE_OBJECT|MAY_BE_FALSE),
F1("imagecreatefromgd2part", MAY_BE_OBJECT|MAY_BE_FALSE),
#if defined(HAVE_GD_BMP)
F1("imagecreatefrombmp", MAY_BE_OBJECT|MAY_BE_FALSE),
#endif
F1("imagecolorsforindex", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG),
F1("imagegetclip", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_LONG|MAY_BE_ARRAY_OF_LONG),
#if defined(HAVE_GD_FREETYPE)
Expand Down
7 changes: 1 addition & 6 deletions ext/gd/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ AC_DEFUN([PHP_GD_PNG],[
PHP_EVAL_LIBLINE([$PNG_LIBS], [GD_SHARED_LIBADD])
PHP_EVAL_INCLINE([$PNG_CFLAGS])
AC_DEFINE([HAVE_LIBPNG], [1], [Define to 1 if you have the libpng library.])
AC_DEFINE([HAVE_GD_PNG], [1], [Define to 1 if gd extension has PNG support.])
])

AC_DEFUN([PHP_GD_AVIF], [
Expand Down Expand Up @@ -191,7 +192,6 @@ AC_DEFUN([PHP_GD_CHECK_VERSION],[
PHP_GD_CHECK_FORMAT([Webp], [AC_DEFINE([HAVE_GD_WEBP], [1])])
PHP_GD_CHECK_FORMAT([Jpeg], [AC_DEFINE([HAVE_GD_JPG], [1])])
PHP_GD_CHECK_FORMAT([Xpm], [AC_DEFINE([HAVE_GD_XPM], [1])])
PHP_GD_CHECK_FORMAT([Bmp], [AC_DEFINE([HAVE_GD_BMP], [1])])
PHP_CHECK_LIBRARY([gd], [gdFontCacheShutdown],
[AC_DEFINE([HAVE_GD_FREETYPE], [1])],
[],
Expand Down Expand Up @@ -257,13 +257,8 @@ if test "$PHP_GD" != "no"; then
libgd/wbmp.c
"])

dnl These are always available with bundled library
AC_DEFINE([HAVE_GD_BUNDLED], [1],
[Define to 1 if gd extension uses GD library bundled in PHP.])
AC_DEFINE([HAVE_GD_PNG], [1],
[Define to 1 if gd extension has PNG support.])
AC_DEFINE([HAVE_GD_BMP], [1],
[Define to 1 if gd extension has BMP support.])

dnl Various checks for GD features
PHP_SETUP_ZLIB([GD_SHARED_LIBADD])
Expand Down
1 change: 0 additions & 1 deletion ext/gd/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ if (PHP_GD != "no") {
gd_crop.c gd_interpolation.c gd_matrix.c gd_bmp.c gd_tga.c", "gd");
AC_DEFINE('HAVE_GD_BUNDLED', 1, "Define to 1 if gd extension uses GD library bundled in PHP.");
AC_DEFINE('HAVE_GD_PNG', 1, "Define to 1 if gd extension has PNG support.");
AC_DEFINE('HAVE_GD_BMP', 1, "Define to 1 if gd extension has BMP support.");
AC_DEFINE('HAVE_LIBPNG', 1, "Define to 1 if you have the libpng library.");
AC_DEFINE('HAVE_LIBJPEG', 1, "Define to 1 if you have the libjpeg library.");
AC_DEFINE('HAVE_GD_JPG', 1, "Define to 1 if gd extension has JPEG support.");
Expand Down
12 changes: 0 additions & 12 deletions ext/gd/gd.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,7 @@ PHP_MINFO_FUNCTION(gd)
#ifdef HAVE_GD_WEBP
php_info_print_table_row(2, "WebP Support", "enabled");
#endif
#ifdef HAVE_GD_BMP
php_info_print_table_row(2, "BMP Support", "enabled");
#endif
#ifdef HAVE_GD_AVIF
php_info_print_table_row(2, "AVIF Support", "enabled");
#endif
Expand Down Expand Up @@ -494,11 +492,7 @@ PHP_FUNCTION(gd_info)
#else
add_assoc_bool(return_value, "WebP Support", 0);
#endif
#ifdef HAVE_GD_BMP
add_assoc_bool(return_value, "BMP Support", 1);
#else
add_assoc_bool(return_value, "BMP Support", 0);
#endif
#ifdef HAVE_GD_AVIF
add_assoc_bool(return_value, "AVIF Support", 1);
#else
Expand Down Expand Up @@ -1329,9 +1323,7 @@ PHP_FUNCTION(imagetypes)
#ifdef HAVE_GD_WEBP
ret |= PHP_IMG_WEBP;
#endif
#ifdef HAVE_GD_BMP
ret |= PHP_IMG_BMP;
#endif
ret |= PHP_IMG_TGA;
#ifdef HAVE_GD_AVIF
ret |= PHP_IMG_AVIF;
Expand Down Expand Up @@ -1716,14 +1708,12 @@ PHP_FUNCTION(imagecreatefromgd2part)
}
/* }}} */

#ifdef HAVE_GD_BMP
/* {{{ Create a new image from BMP file or URL */
PHP_FUNCTION(imagecreatefrombmp)
{
_php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_BMP, "BMP", gdImageCreateFromBmp, gdImageCreateFromBmpCtx);
}
/* }}} */
#endif

/* {{{ Create a new image from TGA file or URL */
PHP_FUNCTION(imagecreatefromtga)
Expand Down Expand Up @@ -2117,7 +2107,6 @@ PHP_FUNCTION(imagegd2)
}
/* }}} */

#ifdef HAVE_GD_BMP
/* {{{ Output BMP image to browser or file */
PHP_FUNCTION(imagebmp)
{
Expand Down Expand Up @@ -2148,7 +2137,6 @@ PHP_FUNCTION(imagebmp)
RETURN_TRUE;
}
/* }}} */
#endif

/* {{{ Destroy an image - No effect as of PHP 8.0 */
PHP_FUNCTION(imagedestroy)
Expand Down
4 changes: 0 additions & 4 deletions ext/gd/gd.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,8 @@ function imagecreatefromgd2(string $filename): GdImage|false {}
/** @refcount 1 */
function imagecreatefromgd2part(string $filename, int $x, int $y, int $width, int $height): GdImage|false {}

#ifdef HAVE_GD_BMP
/** @refcount 1 */
function imagecreatefrombmp(string $filename): GdImage|false {}
#endif

function imagecreatefromtga(string $filename): GdImage|false {}

Expand Down Expand Up @@ -628,10 +626,8 @@ function imagegd(GdImage $image, ?string $file = null): bool {}

function imagegd2(GdImage $image, ?string $file = null, int $chunk_size = 128, int $mode = IMG_GD2_RAW): bool {}

#ifdef HAVE_GD_BMP
/** @param resource|string|null $file */
function imagebmp(GdImage $image, $file = null, bool $compressed = true): bool {}
#endif

function imagedestroy(GdImage $image): true {}

Expand Down
18 changes: 2 additions & 16 deletions ext/gd/gd_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion ext/gd/tests/bug77391.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ gd
--SKIPIF--
<?php
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.5', '<=')) die('skip upstream not yet fixed');
if (!(imagetypes() & IMG_BMP)) die('skip BMP support required');
?>
--FILE--
<?php
Expand Down
4 changes: 0 additions & 4 deletions ext/gd/tests/imagebmp_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
imagebmp() - basic functionality
--EXTENSIONS--
gd
--SKIPIF--
<?php
if (!(imagetypes() & IMG_BMP)) die('skip BMP support required');
?>
--FILE--
<?php
// create an image
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/imagecreatefrombmp_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ imagecreatefrombmp() - basic functionality
gd
--SKIPIF--
<?php
if (!(imagetypes() & IMG_BMP)) die('skip BMP support required');
if (!(imagetypes() & IMG_PNG)) {
die("skip No PNG support");
}
Expand Down
1 change: 0 additions & 1 deletion ext/gd/tests/imagecreatefromstring_bmp.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ imagecreatefromstring() - BMP format
gd
--SKIPIF--
<?php
if (!(imagetypes() & IMG_BMP)) die('skip BMP support required');
if (!(imagetypes() & IMG_PNG)) {
die("skip No PNG support");
}
Expand Down
Loading