public gdlib php image transform stack png transparent php

This GDlib Trick let you stack different transparent png Images to one transparent png. <?php $image_arr=array(‚path1.png‘, ‚path2.png‘, ‚path3.png‘); echo gd_gen_image($image_arr); function gd_gen_image($arr){ $base = imagecreatetruecolor(913, 500); $color = imagecolorallocatealpha($base, 0, 0, 0, 127); imagefill($base, 0, 0, $color); imagesavealpha($base, TRUE); foreach($arr as $key=>$image_val){ $this_layer=imageCreateFromPNG($image_val); ImageCopy ( $base, $this_layer, 0 , 0 , 0 , 0 ,