Skip to content

Commit ba68cbe

Browse files
authored
ext/gd: Make TGA always available (#19105)
- When building with bundled libgd, it has support for TGA - When building with external libgd, at least 2.1.0 is required, which has TGA support.
1 parent 6e22d4c commit ba68cbe

File tree

7 files changed

+2
-28
lines changed

7 files changed

+2
-28
lines changed

ext/gd/config.m4

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ AC_DEFUN([PHP_GD_CHECK_VERSION],[
192192
PHP_GD_CHECK_FORMAT([Jpeg], [AC_DEFINE([HAVE_GD_JPG], [1])])
193193
PHP_GD_CHECK_FORMAT([Xpm], [AC_DEFINE([HAVE_GD_XPM], [1])])
194194
PHP_GD_CHECK_FORMAT([Bmp], [AC_DEFINE([HAVE_GD_BMP], [1])])
195-
PHP_GD_CHECK_FORMAT([Tga], [AC_DEFINE([HAVE_GD_TGA], [1])])
196195
PHP_CHECK_LIBRARY([gd], [gdFontCacheShutdown],
197196
[AC_DEFINE([HAVE_GD_FREETYPE], [1])],
198197
[],
@@ -265,8 +264,6 @@ dnl These are always available with bundled library
265264
[Define to 1 if gd extension has PNG support.])
266265
AC_DEFINE([HAVE_GD_BMP], [1],
267266
[Define to 1 if gd extension has BMP support.])
268-
AC_DEFINE([HAVE_GD_TGA], [1],
269-
[Define to 1 if gd extension has TGA support.])
270267

271268
dnl Various checks for GD features
272269
PHP_SETUP_ZLIB([GD_SHARED_LIBADD])

ext/gd/config.w32

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ if (PHP_GD != "no") {
6262
AC_DEFINE('HAVE_GD_BUNDLED', 1, "Define to 1 if gd extension uses GD library bundled in PHP.");
6363
AC_DEFINE('HAVE_GD_PNG', 1, "Define to 1 if gd extension has PNG support.");
6464
AC_DEFINE('HAVE_GD_BMP', 1, "Define to 1 if gd extension has BMP support.");
65-
AC_DEFINE('HAVE_GD_TGA', 1, "Define to 1 if gd extension has TGA support.");
6665
AC_DEFINE('HAVE_LIBPNG', 1, "Define to 1 if you have the libpng library.");
6766
AC_DEFINE('HAVE_LIBJPEG', 1, "Define to 1 if you have the libjpeg library.");
6867
AC_DEFINE('HAVE_GD_JPG', 1, "Define to 1 if gd extension has JPEG support.");

ext/gd/gd.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,7 @@ PHP_MINFO_FUNCTION(gd)
449449
#ifdef HAVE_GD_AVIF
450450
php_info_print_table_row(2, "AVIF Support", "enabled");
451451
#endif
452-
#ifdef HAVE_GD_TGA
453452
php_info_print_table_row(2, "TGA Read Support", "enabled");
454-
#endif
455453
php_info_print_table_end();
456454
DISPLAY_INI_ENTRIES();
457455
}
@@ -506,11 +504,7 @@ PHP_FUNCTION(gd_info)
506504
#else
507505
add_assoc_bool(return_value, "AVIF Support", 0);
508506
#endif
509-
#ifdef HAVE_GD_TGA
510507
add_assoc_bool(return_value, "TGA Read Support", 1);
511-
#else
512-
add_assoc_bool(return_value, "TGA Read Support", 0);
513-
#endif
514508
#ifdef USE_GD_JISX0208
515509
add_assoc_bool(return_value, "JIS-mapped Japanese Font Support", 1);
516510
#else
@@ -1338,9 +1332,7 @@ PHP_FUNCTION(imagetypes)
13381332
#ifdef HAVE_GD_BMP
13391333
ret |= PHP_IMG_BMP;
13401334
#endif
1341-
#ifdef HAVE_GD_TGA
13421335
ret |= PHP_IMG_TGA;
1343-
#endif
13441336
#ifdef HAVE_GD_AVIF
13451337
ret |= PHP_IMG_AVIF;
13461338
#endif
@@ -1733,14 +1725,12 @@ PHP_FUNCTION(imagecreatefrombmp)
17331725
/* }}} */
17341726
#endif
17351727

1736-
#ifdef HAVE_GD_TGA
17371728
/* {{{ Create a new image from TGA file or URL */
17381729
PHP_FUNCTION(imagecreatefromtga)
17391730
{
17401731
_php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_TGA, "TGA", gdImageCreateFromTga, gdImageCreateFromTgaCtx);
17411732
}
17421733
/* }}} */
1743-
#endif
17441734

17451735
/* {{{ _php_image_output */
17461736
static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, const char *tn)

ext/gd/gd.stub.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,9 +594,7 @@ function imagecreatefromgd2part(string $filename, int $x, int $y, int $width, in
594594
function imagecreatefrombmp(string $filename): GdImage|false {}
595595
#endif
596596

597-
#ifdef HAVE_GD_TGA
598597
function imagecreatefromtga(string $filename): GdImage|false {}
599-
#endif
600598

601599
function imagexbm(GdImage $image, ?string $filename, ?int $foreground_color = null): bool {}
602600

ext/gd/gd_arginfo.h

Lines changed: 2 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/gd/tests/imagecreatefromtga_basic.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ imagecreatefromtga() - basic functionality
44
gd
55
--SKIPIF--
66
<?php
7-
if (!(imagetypes() & IMG_TGA)) die('skip TGA support required');
87
if (!(imagetypes() & IMG_PNG)) {
98
die("skip No PNG support");
109
}

ext/gd/tests/imagecreatefromtga_variation.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ imagecreatefromtga() - RLE file reading
44
gd
55
--SKIPIF--
66
<?php
7-
if (!(imagetypes() & IMG_TGA)) die('skip TGA support required');
87
if (!(imagetypes() & IMG_PNG)) {
98
die("skip No PNG support");
109
}

0 commit comments

Comments
 (0)