codice:
<?php
$myImageZoom = imagecreatefromjpeg('sample.jpg');
$img = imagecreatefromjpeg('back.jpg');
$src_img = $myImageZoom;
$src_w = imagesx($myImageZoom);
$src_h = imagesy($myImageZoom);
$dst_w = $src_w;
$dst_h = $src_h;
$dst_img = imagecreatetruecolor($dst_w, $dst_h);
imagecopy($dst_img, $src_img, 0, 0, 0, 0, $dst_w, $dst_h);
$mask = $img;
$maskTransparent = imagecolorallocate($mask, 255, 0, 255);
imagecolortransparent($mask, $maskTransparent);
imagefilledellipse($mask, $dst_w / 2, $dst_h / 2, $dst_w, $dst_h, $maskTransparent);
imagecopymerge($dst_img, $mask, 0, 0, 0, 0, $dst_w, $dst_h, 100);
$dstTransparent = imagecolorallocate($dst_img, 255, 0, 255);
imagefill($dst_img, 0, 0, $dstTransparent);
imagefill($dst_img, $dst_w - 1, 0, $dstTransparent);
imagefill($dst_img, 0, $dst_h - 1, $dstTransparent);
imagefill($dst_img, $dst_w - 1, $dst_h - 1, $dstTransparent);
imagecolortransparent($dst_img, $dstTransparent);
imagecopy($img, $dst_img, 20, 20, 0, 0, imagesx($dst_img), imagesy($dst_img));
if(!imagepng($img, "imgfinale.png")) die('Salvataggio immagine fallito');
?>
Read more at https://www.inforge.net/xi/threads/php-librerie-gd-imagefilledellipse-con-trasprenza.451126/#tIE0eYGfT6LzmcqQ.99
[/SPOILER]