Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

imagetypes

Description

The imagetypes of Image for PHP return the image types supported by this PHP build.

Syntax

imagetypes(): int

Return

Returns a bit-field corresponding to the image formats supported by the version of GD linked into PHP.

The following bits are returned:

NumberImage Type
1IMG_GIF
2IMG_JPG
4IMG_PNG
8IMG_WBMP
16IMG_XPM
32IMG_WEBP
64IMG_BMP
128IMG_TGA
256IMG_AVIF

Examples

1 · return

<?

$return = imagetypes();

echo $return;

?>
255

2 · supported

<?

$return = imagetypes();
$array = array(
    IMG_GIF,
    IMG_JPG,
    IMG_PNG,
    IMG_WBMP,
    IMG_XPM,
    IMG_WEBP,
    IMG_BMP,
    IMG_TGA,
    IMG_AVIF
);

echo "supported:" . PHP_EOL;
for($i = 0; $i < count($array); ++$i)
{
    if($return & $array[$i])
    {
        echo $array[$i] . PHP_EOL;
    }
}

?>
supported:
1
2
4
8
16
32
64
128
HomeMenu