Jump to content


New Members
  • Posts

  • Joined

  • Last visited

3dron's Achievements


Newbie (1/5)



  1. I have code like this in a function: function stacklayer($folder, $layer) { $newlayer = imagecreatefrompng($folder . '/' . $layer . '.png'); imagecopy($baseimage,$newlayer,0,0,0,0,$w,$h); imagedestroy($newlayer); } stacklayer('Layer1', 'Image1') But $baseimage does not have the new layers added on top of $baseimage created outside the function. In this manner: $baseimage = imagecreatefrompng("Base.png"); $w = imagesx($baseimage); $h = imagesy($baseimage); imagealphablending($baseimage,true); If I run this outside the function it adds the layers as intended. $folder = 'Layer1', $layer = 'Image1'; $newlayer = imagecreatefrompng($folder . '/' . $layer . '.png'); imagecopy($baseimage,$newlayer,0,0,0,0,$w,$h); imagedestroy($newlayer); Any help? Thanks 3dron
  2. Thanks, it all makes sense now. I cannot use arrays/objects because the function is actually taking in many variables and creating new generated variable names and also newly generated variables. I am not a programmer at all, I am a 3D animator that has hacked my way through programming learning what is needed on the fly from the past 35 years. I solved all my current issues with your help. But am now stuck on a new one I know you can solve in a second. LEt me post a new topic so others can find the help in the future. Then I will reference it here. Thanks 3dron
  3. Ok, so how can I have access to the named variables in one function to another? I have an input array or db, that feeds the first function. Then I have to run a separate function after all the variables have been created. Because the second array is feed the original first input but also a properties input that has to check the values of the newly created variables. Then were applicable run certain operations based on what some of those variables values are. Please help. 3dron
  4. I am trying to create some variety able variable names in one function, but declaring them global is not carrying them over inside another function. Here is an over simplified example: myfunction($name) { global ${$name}; ${$name} = "Hello world."; } myfunction2($name2) { echo ${$name2}; } $var = "testname"; myfunction($var); //shouldn't there now be a global variable named $testname; myfunction2("testname"); //shouldn't this echo "Hello world." Please help.
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.