我有2个源图像,我想:
我尝试了很多例子,但似乎无法保持最终图像的透明度.
我正在努力实现这样的目标:

这是我得到的输出的一个例子:

这是我的circle_crop函数:
function create_circle( $img_path ) {
// Attribution: by NerdsOfTech
// Step 1 - Start with image as layer 1 (canvas).
if (! $img1 = $this->imageCreateFromAny( $img_path )) {
return FALSE;
}
$x=imagesx($img1);
$y=imagesy($img1);
// Step 2 - Create a blank image.
$img2 = imagecreatetruecolor($x, $y);
$bg = imagecolorallocate($img2, 255,0,255, 127); // wierdo pink background
// $bg = imagecolorallocate($img2, 0, 0, 0, 127 ); // white background
imagefill($img2, 0, 0, $bg);
imagecolortransparent($img2, …Run Code Online (Sandbox Code Playgroud)