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 , 913 , 500 );
    }

    // Begin capturing the byte stream
    ob_start();
        imagePNG($base);
    $out=ob_get_clean();
    // END capturing the byte stream
    return "<img src='data:image/png;base64," . base64_encode( $out ) . "' />";
}

?>

@public #gdlib #php #image #transform #stack #png #transparent

Statt PNG als JPG ausgeben: http://codebase.webmaster-fragen.de/snippet/public-gdlib-php-image-transform-stack-php/