note 57282 added to function.getimagesize
| From: | cvig at raw-io dot com | Date: | Thu, 29 Sep 2005 13:06:15 +0000 |
| Subject: | note 57282 added to function.getimagesize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-95970@lists.php.net to get a copy of this message | ||
This function does not work to catch corrupted PNG images. The alternative is to use
ImageMagick's identify tool. Due to some sort of odd output usage the output from
ImageMagick's identify won't be returned but you can use the return value from the program
to test if a PNG file is valid:
#!/usr/bin/php
<?php
if (! $argv[1])
exit("$argv[0] filename.png\n");
$result = 0;
$tmp;
exec("identify $argv[1]", $tmp, $result);
if($result)
{
echo "Corrupted image\n";
return FALSE; // corrupt PNG file
}
else
{
echo "Valid image\n";
return TRUE;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.getimagesize.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57282
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57282&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57282&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57282&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57282&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57282&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57282&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57282&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57282&report=yes
Search -- http://master.php.net/manage/user-notes.php