Code Snippets Php

if($img = @GetImageSize("ihcomputing1.gif"))
{
switch ($img[2])
{
case 1 :
echo "image is a gif";
break;
case 2 :
echo "image is a jpeg";
break;
case 3 :
echo "image type is PNG";
break;
case 4 :
echo "image type is SWF";
break;
case 5 :
echo "image type is PSD";
break;
case 6 :
echo "image type is BMP";
break;
}
}
else
{
echo "image does not exist";
}
?>