image processing - Strange result of making one picture from to on PHP -


in project, need merge 2 pictures.

the first (img.png):

img http://uoops.ru/1/img.png

and (for example) second (photo.png):

img http://uoops.ru/1/photo.png

this php code:

$photoimage = imagecreatefrompng("img.png"); imagealphablending($photoimage, true);  $logoimage = imagecreatefrompng("photo.png"); $logow = imagesx($logoimage); $logoh = imagesy($logoimage); imagecopy($photoimage, $logoimage, 1, 1, 0, 0, $logow, $logoh);  imagepng($photoimage, "mrkr.png", 0); 

as result want have this:

http://uoops.ru/1/result.png

but have this:

http://uoops.ru/1/mrkr.png

how can fix this?

$photoimage = imagecreatefrompng("img.png");  $w = imagesx($photoimage); $h = imagesy($photoimage); $out = imagecreatetruecolor($w, $h); imagealphablending($out, true); imagefill($out, 0, 0, imagecolorallocatealpha($out, 0, 0, 0, 127)); imagesavealpha($out, true);  imagecopy($out, $photoimage, 0, 0, 0, 0, $w, $h);  $logoimage = imagecreatefrompng("photo.png"); $logow = imagesx($logoimage); $logoh = imagesy($logoimage); imagecopy($out, $logoimage, 1, 1, 0, 0, $logow, $logoh); imagepng($out, "mrkr.png", 0); 

this not optimized should work


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -