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:
| Number | Image Type |
|---|---|
| 1 | IMG_GIF |
| 2 | IMG_JPG |
| 4 | IMG_PNG |
| 8 | IMG_WBMP |
| 16 | IMG_XPM |
| 32 | IMG_WEBP |
| 64 | IMG_BMP |
| 128 | IMG_TGA |
| 256 | IMG_AVIF |
Examples
1 · return
<? $return = imagetypes(); echo $return;
511
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 256
Links
Image
- gd_info
- getimagesize
- getimagesizefromstring
- image_type_to_extension
- image_type_to_mime_type
- imageaffine
- imageaffinematrixconcat
- imageaffinematrixget
- imagealphablending
- imageantialias
- imagearc
- imageavif
- imagebmp
- imagechar
- imagecharup
- imagecolorallocate
- imagecolorallocatealpha
- imagecolorat
- imagecolorclosest
- imagecolorclosestalpha
- imagecolorclosesthwb
- imagecolordeallocate
- imagecolorexact
- imagecolorexactalpha
- imagecolormatch
- imagecolorresolve
- imagecolorresolvealpha
- imagecolorset
- imagecolorsforindex
- imagecolorstotal
- imagecolortransparent
- imageconvolution
- imagecopy
- imagecopymerge
- imagecopymergegray
- imagecopyresampled
- imagecopyresized
- imagecreate
- imagecreatefromavif
- imagecreatefrombmp
- imagecreatefromgif
- imagecreatefromjpeg
- imagecreatefrompng
- imagecreatefromstring
- imagecreatefromtga
- imagecreatefromwbmp
- imagecreatefromwebp
- imagecreatefromxbm
- imagecreatefromxpm
- imagecreatetruecolor
- imagecrop
- imagecropauto
- imagedashedline
- imagedestroy
- imageellipse
- imagefill
- imagefilledarc
- imagefilledellipse
- imagefilledpolygon
- imagefilledrectangle
- imagefilltoborder
- imagefilter
- imageflip
- imagefontheight
- imagefontwidth
- imageftbbox
- imagefttext
- imagegammacorrect
- imagegetclip
- imagegetinterpolation
- imagegif
- imageinterlace
- imageistruecolor
- imagejpeg
- imagelayereffect
- imageline
- imageloadfont
- imageopenpolygon
- imagepalettecopy
- imagepalettetotruecolor
- imagepng
- imagepolygon
- imagerectangle
- imageresolution
- imagerotate
- imagesavealpha
- imagescale
- imagesetbrush
- imagesetclip
- imagesetinterpolation
- imagesetpixel
- imagesetstyle
- imagesetthickness
- imagesettile
- imagestring
- imagestringup
- imagesx
- imagesy
- imagetruecolortopalette
- imagettfbbox
- imagettftext
- imagewbmp
- imagewebp
- imagexbm
- iptcembed
- iptcparse