Skip to content

Instantly share code, notes, and snippets.

@sgricci
Created May 16, 2011 04:55
Show Gist options
  • Save sgricci/973952 to your computer and use it in GitHub Desktop.
Save sgricci/973952 to your computer and use it in GitHub Desktop.
Check Image Support in PHP
<?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;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment