php8.5
Home/ Manual/ image / functions/ imagetypes

imagetypes

PHP function Edit on GitHub ✎

(PHP 4 >= 4.0.2, PHP 5, PHP 7, PHP 8)

Return the image types supported by this PHP build

Description

imagetypes(): int

Returns the image types supported by the current PHP installation.

Parameters Parameters

Return Values

Returns a bit-field corresponding to the image formats supported by the version of GD linked into PHP. The following bits are returned, IMG_AVIF | IMG_BMP | IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP | IMG_XPM | IMG_WEBP.

Changelog

VersionDescription
8.1.0IMG_AVIF added.
7.2.0IMG_BMP added.
7.0.10IMG_WEBP added.

Examples

Checking for PNG support

php
<?php
if (imagetypes() & IMG_PNG) {
    echo "PNG Support is enabled";
}
?>

See Also

Source: reference/image/functions/imagetypes.xml · from the official PHP manual (php/doc-en)