note 105033 added to function.getimagesize
| From: | utilmind at osu1 dot php dot net | Date: | Sat, 23 Jul 2011 10:17:49 +0000 |
| Subject: | note 105033 added to function.getimagesize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-181803@lists.php.net to get a copy of this message | ||
Here is the function which determines whether the PNG image contains alpha or not:
function is_alpha_png($fn){
return (ord(@file_get_contents($fn, NULL, NULL, 25, 1)) == 6);
}
The color type of PNG image is stored at byte offset 25. Possible values of that 25'th byte is:
* 0 - greyscale
* 2 - RGB
* 3 - RGB with palette
* 4 - greyscale + alpha
* 6 - RGB + alpha
----
Server IP: 69.147.83.197
Probable Submitter: 91.200.180.180
----
Manual Page -- http://www.php.net/manual/en/function.getimagesize.php
Edit -- https://master.php.net/note/edit/105033
Del: integrated -- https://master.php.net/note/delete/105033/integrated
Del: useless -- https://master.php.net/note/delete/105033/useless
Del: bad code -- https://master.php.net/note/delete/105033/bad+code
Del: spam -- https://master.php.net/note/delete/105033/spam
Del: non-english -- https://master.php.net/note/delete/105033/non-english
Del: in docs -- https://master.php.net/note/delete/105033/in+docs
Del: other reasons-- https://master.php.net/note/delete/105033
Reject -- https://master.php.net/note/reject/105033
Search -- https://master.php.net/manage/user-notes.php