note 17063 added to function.getimagesize
| From: | lordxois at fuse dot net | Date: | Sat, 24 Nov 2001 04:59:52 +0000 |
| Subject: | note 17063 added to function.getimagesize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-21222@lists.php.net to get a copy of this message | ||
ive found that the GetImageSize function can be used quite well for testing for image types, using
element [2] of the array.
despite the notes of the function, GetImageSize does not return an error code when trying to load a
non-image (php4) and instead just returns null. heres a sample of code i put together to test file
$img to see if its a valid jpeg file.
$size = GetImageSize("$img");
if($size2[2]==2) {
echo "$img"." is a valid JPEG image.";
}
else {
echo "$img"." is not a valid JPEG image.";
}
--
http://www.php.net/manual/en/function.getimagesize.php
http://master.php.net/manage/user-notes.php?action=edit+17063
http://master.php.net/manage/user-notes.php?action=delete+17063
http://master.php.net/manage/user-notes.php?action=reject+17063