Merging two images with transparent sections produces the following composite image:
I'm wondering why the transparent section of the image I've overlayed onto the green background shows up as such? Anyone?
$base = imagecreatefrompng('application/assets/images/vel1_bg.png');
imagealphablending($base, false);
imagesavealpha($base, true);
list($baseWidth, $baseHeight, $type, $attr) = getimagesize('application/assets/images/vel1_bg.png');
$user_board_items = $this->config->item('user_board_items');
foreach($array as $key => $value){
$item = imagecreatefrompng('application/assets/images/items/' . $user_board_items[$value[0]] . '.png');
imagealphablending($item, false);
imagesavealpha($item, true);
list($width, $height, $type, $attr) = getimagesize('application/assets/images/items/'. $user_board_items[$value[0]] . '.png');
imagecopyresampled($base,
$item,
floor(($value[1] / 100) * $baseWidth),
floor(($value[2] / 100) * $baseHeight),
0,
0,
$width,
$height,
$width,
$height);
imagedestroy($item);
}
//We have to capture the output buffer
ob_start();
imagepng($base);
$baseimg = ob_get_clean();