WoW Gold - Debt Consolidation - Wordpress Theme - Debt Consolidation - Sport Betting Bonuses

PDA

View Full Version : Image Format Detection


!Unreal
Mar 9th 2009, 10:55 am
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;
?>

SmallPotatoes
Mar 9th 2009, 1:54 pm
You didn't close the { that you opened on the switch() line.

!Unreal
Mar 9th 2009, 2:00 pm
yeah I just realised lol