note 89467 modified in function.image-type-to-mime-type by danbrown

From: Date: Mon, 09 Mar 2009 19:13:18 +0000
Subject: note 89467 modified in function.image-type-to-mime-type by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-151661@lists.php.net to get a copy of this message
I was looking to detect the format of images, Im not sure if this is the best way but it works for me. <?php $filename = 'http://static.php.net/www.php.net/images/php.gif'; $size = getimagesize($filename); switch ($size['mime']) { case "image/gif": echo "Image is a gif"; break; case "image/jpeg": echo "Image is a jpeg"; break; case "image/png": echo "Image is a png"; break; case "image/bmp": echo "Image is a bmp"; break; } ?> --was-- I was looking to detect the format of images, Im not sure if this is the best way but it works for me. <?php $filename = 'http://static.php.net/www.php.net/images/php.gif'; $size = getimagesize($filename); switch ($size['mime']) { case "image/gif": echo "Image is a gif"; break; case "image/jpeg": echo "Image is a jpeg"; break; case "image/png": echo "Image is a png"; break; case "image/bmp": echo "Image is a bmp"; break; } ?> http://php.net/manual/en/function.image-type-to-mime-type.php

« previous php.notes (#151661) next »