Strange php behaviour on a gd function

Posted by mck89 on Stack Overflow See other posts from Stack Overflow or by mck89
Published on 2010-04-13T14:33:46Z Indexed on 2010/04/13 15:23 UTC
Read the original article Hit count: 376

Filed under:
|
|

Hi, i met a very strange PHP behaviour, i don't understand why it behaves like this. I'm using the imagesetbrush function in this way:

class foo
{
   function setbrush($image)
   {
       //$this->_resource contains the main image resource
       imagesetbrush($this->_resource, $image);
   }
}
...
$res=imagecreatefrompng("image.png");
$class->setbrush($res);

in this way it works, but if i change the code like this:

class foo
{
   function setbrush($image)
   {
       $res=imagecreatefrompng($image);
       imagesetbrush($this->_resource, $res);
   }
}
...
$class->setbrush("image.png");

it doesn't work anymore. Do you see some error? It doesn't show me any message it simply doesn't execute the function.

© Stack Overflow or respective owner

Related posts about php

Related posts about gd