note 61514 deleted from function.getimagesize by cmb
| From: | cmb@php.net | Date: | Sun, 18 Dec 2016 09:35:41 +0000 |
| Subject: | note 61514 deleted from function.getimagesize by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208620@lists.php.net to get a copy of this message | ||
Note Submitter: John
----
I was coming here to see if there was a simple way to get the height, width, and mime type of an
image I have uploaded and while I thought the following code would work because it is printed above
<?php
list($width, $height, $type, $attr) = getimagesize("img/flag.jpg");
?>
it didnt when I tried to echo out $type; so heres my fix, there may be a better way but it works for
me!
<?php
$blah = getimagesize("folder/file.gif");
$type = $blah['mime'];
$width = $blah[0];
$height = $blah[1];
?>
and then you can just echo out one of the variables about to get whichever you would desire.