<?php
int imagetypes ()
?>
IMAGE TYPE CONSTANTS | ||
CONSTANT | VALUE | MEANING |
IMG_GIF | 1 | GIF IMAGES |
IMG_JPG | 2 | JPEG IMAGES |
IMG_JPEG | ||
IMG_PNG | 4 | PNG IMAGES |
IMG_WBMP | 8 | WBMP IMAGES |
IMG_XPM | 16 | XPM IMAGES |
IMG_WEBP | 32 | WEBP IMAGES |
IMG_BMP | 64 | BMP IMAGES |
IMG_TGA | 128 | TGA IMAGES As of PHP 7.4.0 |
IMG_AVIV | 256 | AVIF IMAGES As of PHP 8.1.0 |
ed48 |
<?php
// Run this code to see the result
echo 'PHP ' . PHP_VERSION . '<br><br>';
if(PHP_VERSION_ID <= 80100)
{
$imgtypes01 = [ "IMG_GIF" => IMG_GIF,
"IMG_JPG" => IMG_JPG, "IMG_JPEG" => IMG_JPEG,
"IMG_PNG" => IMG_PNG, "IMG_WBMP" => IMG_WBMP,
"IMG_XPM" => IMG_XPM, "IMG_WEBP" => IMG_WEBP,
"IMG_BMP" => IMG_BMP, "IMG_TGA" => IMG_TGA ];
}
else
{
$imgtypes01 = [ "IMG_GIF" => IMG_GIF,
"IMG_JPG" => IMG_JPG, "IMG_JPEG" => IMG_JPEG,
"IMG_PNG" => IMG_PNG, "IMG_WBMP" => IMG_WBMP,
"IMG_XPM" => IMG_XPM, "IMG_WEBP" => IMG_WEBP,
"IMG_BMP" => IMG_BMP, "IMG_TGA" => IMG_TGA,
"IMG_AVIF" => IMG_AVIF ];
}
foreach($imgtypes01 as $kt => $vt)
{
echo $kt . ' => ';
var_dump((imagetypes() & $vt));
echo '<br>';
}
?>
<?php
// Run this code to see the result
echo 'PHP ' . PHP_VERSION . '<br><br>';
if(PHP_VERSION_ID <= 80100)
{
$imgtypes01 = [ 1 => IMG_GIF,
2 => IMG_JPG, 2 => IMG_JPEG,
4 => IMG_PNG, 8 => IMG_WBMP,
16 => IMG_XPM, 32 => IMG_WEBP,
64 => IMG_BMP, 128 => IMG_TGA ];
}
else
{
$imgtypes01 = [ 1 => IMG_GIF,
2 => IMG_JPG, 2 => IMG_JPEG,
4 => IMG_PNG, 8 => IMG_WBMP,
16 => IMG_XPM, 32 => IMG_WEBP,
64 => IMG_BMP, 128 => IMG_TGA,
256 => IMG_AVIF ];
}
foreach($imgtypes01 as $kt => $vt)
{
echo $kt . ' => ';
var_dump((imagetypes() & $vt));
echo '<br>';
}
?>