note 82096 added to function.imagecolortransparent

From: Date: Thu, 27 Mar 2008 13:56:27 +0000
Subject: note 82096 added to function.imagecolortransparent
Groups: php.notes 
Request: Send a blank email to php-notes+get-137632@lists.php.net to get a copy of this message
Sorry, below should be: <?php $is_alpha = ord (file_get_contents ($file_path, false, null, 25, 1)) & 4; ?> much better :) Both types 4 (greyscale transparent png), and 6 (colour transparent png) have bit 4 set, so there's no need to bitwise twice and there's no need for == as the return value will be 4 or 0, which is easily interpreted as true or false elsewhere in your code. note: file_get_contents isn't reading the whole file in this instance, just 1 byte on its own and that's it, so you can be assured this is fast and safe. ---- Server IP: 69.147.83.197 Probable Submitter: 82.44.33.144 ---- Manual Page -- http://www.php.net/manual/en/function.imagecolortransparent.php Edit -- https://master.php.net/note/edit/82096 Del: integrated -- https://master.php.net/note/delete/82096/integrated Del: useless -- https://master.php.net/note/delete/82096/useless Del: bad code -- https://master.php.net/note/delete/82096/bad+code Del: spam -- https://master.php.net/note/delete/82096/spam Del: non-english -- https://master.php.net/note/delete/82096/non-english Del: in docs -- https://master.php.net/note/delete/82096/in+docs Del: other reasons-- https://master.php.net/note/delete/82096 Reject -- https://master.php.net/note/reject/82096 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137632) next »