note 17063 deleted from function.getimagesize by jimw
| From: | jimw@php.net | Date: | Mon, 10 Dec 2001 23:33:16 +0000 |
| Subject: | note 17063 deleted from function.getimagesize by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22478@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.";
}