note 13751 deleted from function.getimagesize by jimw
| From: | jimw@php.net | Date: | Mon, 10 Dec 2001 23:31:57 +0000 |
| Subject: | note 13751 deleted from function.getimagesize by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22471@lists.php.net to get a copy of this message | ||
I found I could check for image existence with the following:
// if img exists
if($img = @GetImageSize ("img.gif")) { echo "yes"; }
else { echo "no"; }
//sample code
if($img = @GetImageSize ("img.gif")) {
echo "<b>Image exsists</b>";
// return image width
echo "width = $img[0]";
// return image height
echo "height = $img[1]";
//return image type
switch ($img[2]) {
case 1:
echo "type = GIF";
break;
case 2:
echo "type = JPG";
break;
case 3:
echo "type = PNG";
break;
case 4:
echo "type = SWF";
break;
}
// return string width x height
echo "width x height = $img[3]";
}
else { echo "Image does not exsist"; }