1Unreal
03-09-2009, 04:58 PM
Im trying to detect the format of an image. But I get a parse error
<?php
$filename = 'http://static.php.net/www.php.net/images/php.gif';
$file = fopen($filename, 'rb');
$size = getimagesize($file);
switch ($size['mime']) {
case "IMAGETYPE_GIF":
echo "Image is a gif";
break;
case "IMAGETYPE_JPEG":
echo "Image is a jpeg";
break;
case "IMAGETYPE_PNG":
echo "Image is a png";
break;
?>
<?php
$filename = 'http://static.php.net/www.php.net/images/php.gif';
$file = fopen($filename, 'rb');
$size = getimagesize($file);
switch ($size['mime']) {
case "IMAGETYPE_GIF":
echo "Image is a gif";
break;
case "IMAGETYPE_JPEG":
echo "Image is a jpeg";
break;
case "IMAGETYPE_PNG":
echo "Image is a png";
break;
?>