note 61514 added to function.getimagesize
| From: | John at osu1 dot php dot net | Date: | Mon, 06 Feb 2006 07:57:27 +0000 |
| Subject: | note 61514 added to function.getimagesize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-103065@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 216.194.113.175
Probable Submitter: 166.82.177.165
----
Manual Page -- http://www.php.net/manual/en/function.getimagesize.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61514
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61514&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61514&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61514&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61514&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61514&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61514&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61514&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61514&report=yes
Search -- http://master.php.net/manage/user-notes.php