note 51471 added to function.imagecolortransparent
| From: | partyheld at HATESPAMgmail dot com | Date: | Thu, 31 Mar 2005 17:35:50 +0000 |
| Subject: | note 51471 added to function.imagecolortransparent | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87275@lists.php.net to get a copy of this message | ||
Fred wrote:
<?php
$file['signatur']= substr($result,0,3);
$file['version']= substr($result,3,3);
$file['width']=
ord(substr($result,6,1))+ord(substr($result,7,1))*256;
$file['height']= ord(substr($result,8,1))+ord(substr($rsult,9,1))*256;
$file['flag']= ord(substr($result,10,1))>>7;
$file['trans_red']= ord(substr($result,ord(substr($result,11))*3,1));
$file['trans_green']= ord(substr($result,ord(substr($result,11))*3+1,1));
$file['trans_blue']= ord(substr($result,ord(substr($result,11))*3+2,1)) ;
?>
You should write such code like this:
<?php
$file = array(
"signatur" => substr ($result, 0, 3),
"version" => substr ($result, 3, 3),
"width" => ord (substr ($result, 6, 1)) + ord (substr ($result, 7,
1)) * 256,
"height" => ord (substr ($result, 8, 1)) + ord(substr ($result, 9,
1)) * 256,
"flag" => ord (substr ($result, 10, 1)) >> 7,
"trans_red" => ord (substr ($result, ord (substr ($result, 11)) * 3,1)),
"trans_green" => ord (substr ($result, ord (substr($result, 11)) * 3 + 1,
1)),
"trans_blue" => ord (substr ($result, ord (substr($result, 11)) * 3 + 2,
1))
);
?>
And there's a typo in line 4, sayin "rsult" instead of "result". I've
got no time for checking your code any further, sorry.
----
Manual Page -- http://www.php.net/manual/en/function.imagecolortransparent.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51471
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51471&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51471&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51471&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51471&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51471&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51471&report=yes
Search -- http://master.php.net/manage/user-notes.php