I've been working with PHP's GD Library for a few weeks now and I've found something that maybe able to be helpful to certain aspects of my site. This is the imagecopymerge() function.I've succesfully merged two images together.http://entitys-arena.co.uk/images/RoE/GD.phpNow, what I am trying to build here is a battle scene, but as it is, I've hit a wall when trying to merge more than two items together, so I could have more than one monster/thing on the image at once. Is there anyway I could merge more than two images together?Here is the current code:
<? header('content-type: image/jpeg'); $max_monsters = 3; $monster_img = array('01', '02', '03', '04'); $monster_base_url = "/home/.flirt/entity_azirius/entitys-arena.co.uk/images/RoE/"; $monster_back_url = "back/"; $monsters_url = "monsters/"; $count = count($monster_img); $select = rand(0, ($count - 1)); $mons_src = $monster_img[$select]; $monster = imagecreatefrompng("/home/.flirt/entity_azirius/entitys-arena.co.uk/images/RoE/monsters/$mons_src.png"); $monster_width = imagesx($monster); $monster_height = imagesy($monster); $image = imagecreatetruecolor($monster_width, $monster_height); $image = imagecreatefromjpeg("/home/.flirt/entity_azirius/entitys-arena.co.uk/images/RoE/back/01.jpg"); $size = getimagesize("/home/.flirt/entity_azirius/entitys-arena.co.uk/images/RoE/back/01.jpg"); $dest_x = $size[0] / 8; $dest_y = $size[1] / 4; imagecopymerge($image, $monster, $dest_x, $dest_y, 0, 0, $monster_width, $monster_height, 100); imagejpeg($image); imagedestroy($image); imagedestroy($monster);?>
If there is someone who thinks they can help me, I'll be very greatful