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;
?>

You're missing the closing curly bracket.

<?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;
  }
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.