Skip to content

Instantly share code, notes, and snippets.

@alivx
Created September 23, 2022 12:15
Show Gist options
  • Save alivx/f177ec7fd32ca837acd26aa4c5f8feff to your computer and use it in GitHub Desktop.
Save alivx/f177ec7fd32ca837acd26aa4c5f8feff to your computer and use it in GitHub Desktop.
Check installed php Image support
<?php
function check_image_support()
{
echo 'Checking Image Support: '."\n";
//IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP | IMG_XPM
if (imagetypes() & IMG_GIF)
echo "GIF: \tYes";
else
echo "GIF: \tNo";
echo "\n";
if (imagetypes() & IMG_JPG)
echo "JPG: \tYes";
else
echo "JPG: \tNo";
echo "\n";
if (imagetypes() & IMG_PNG)
echo "PNG: \tYes";
else
echo "PNG: \tNo";
echo "\n";
if (imagetypes() & IMG_WBMP)
echo "WBMP: \tYes";
else
echo "WBMP: \tNo";
echo "\n";
if (imagetypes() & IMG_XPM)
echo "XPM: \tYes";
else
echo "XPM: \tNo";
echo "\n";
echo "Support Check Complete\n";
return;
}
check_image_support()
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment