// Set the path to the image
$image_path = getcwd() . DIRECTORY_SEPARATOR . 'gibson_sg.png';
// Get the image width, height, and type
$image_info = getimagesize($image_path);
$image_width = $image_info[0];
$image_height = $image_info[1];
$image_type = $image_info[2];
// Display the image type
switch($image_type) {
case IMAGETYPE_JPEG:
echo("This is a JPEG image.<br>");
break;
case IMAGETYPE_GIF:
echo("This is a GIF image.<br>");
break;
case IMAGETYPE_PNG:
echo("This is a GIF image.<br>");
break;
default:
echo("File must be a JPEG, GIF, or PNG image.<br>");
exit;
}