Jump to content

Need help on adding more imagecopy paremeters..


Monkuar

Recommended Posts

right my code now is:

 

$stars = imagecreatefrompng("./img/nrpg/base_m.png");



  $gradient = imagecreatefrompng("./img/nrpg/swords/sword2.png");
  

// Copy
imagecopy($stars,  $gradient, -2, 21, 0, 0, 39, 39);

// Output and free from memory
header('Content-Type: image/png');
imagesavealpha($gradient,true);
imagesavealpha($stars,true);
imagepng($stars);
  
  

  imagedestroy($stars);
  imagedestroy($gradient);

 

 

And it shows:

 

MY male character with his sword in the correct position.

 

But what If I want to add a hat/boots/gloves?  How would I go about that?

 

Pretty much I need a way to add more imagecopy items over the item

Multiple calls to imagecopy?

 

WOW

did not know you could that

// Create image instances
$character = imagecreatefrompng("./img/nrpg/base_m.png");
$sword = imagecreatefrompng("./img/nrpg/swords/sword2.png");
$boots = imagecreatefrompng("./img/nrpg/boots/boots1.png");
  

// Copy
imagecopy($character,  $sword, -2, 21, 0, 0, 39, 39);
imagecopy($character,  $boots, 29, 75, 0, 0, 38, 35);

// Output and free from memory
header('Content-Type: image/png');
imagesavealpha($character,true);
imagesavealpha($sword,true);
imagesavealpha($boots,true);
imagepng($character);

 

This is what I call server side securitY! Haha, now just check if the user has those items bought, and make the image server side.  This is epic.

 

OMG awesome, Thanks xyph!!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.