I want to combine the image with its own image flipping and rotate at an angle of, say, 60 degrees.
Suppose I have an image of 1000 * 1000 px, then A: the original image is resized to 500 * 500 pixels and the location in the lower right is 1000 * 1000 square squares B: the same image is inverted and rotated -600 degrees and place in the upper left corner 1000 * 1000 square box
everything works fine, but just a question, like
1: some border for rotated images
2: the background for rotation is one darker so that it looks odd.
test case:
sample image (thumbnail reduced, click to open original image):

image output :

Below is my code
$image1=$image2=imagecreatefrompng('a.png');
//filter_opacity( $image1, 25 );
$w=imagesx($image1);
$h=imagesy($image1);
$finala = imagecreatetruecolor($w, $h);
$finalb = imagecreatetruecolor($w, $h);
$finalc = imagecreatetruecolor($w, $h);
$backgroundColora = imagecolorallocate($finala, 250,252,252); // gray
$backgroundColorb = imagecolorallocate($finalb, 250,250,250); // gray
$backgroundColorc = imagecolorallocate($finalc, 250,250,250); // gray
imagefill($finala, 0, 0, $backgroundColora);
imagefill($finalb, 0, 0, $backgroundColorb);
imagefill($finalc, 0, 0, $backgroundColorc);
$percent = 0.583;
$new_width = $w * $percent;
$new_height = $h * $percent;
$wshift = $w/8.5;
$hshift = $h/2.5;
imagecopy($finala, $image1, 0,0,0,0,$w,$h);
imagecopyresampled($finala, $image2,$wshift,$hshift,0,0, $new_width, $new_height, $w, $h);
imagecopy($finalc, $image1, 0,0,0,0,$w,$h);
imagecopyresampled($finalc, $image2,$wshift,$hshift,0,0, $new_width, $new_height, $w, $h);
imagecopyresampled($finalb, $finalc,$w*0.3,$h*0.3,0,0, $w*0.6, $h*0.6, $w, $h);
imageflip($finala, IMG_FLIP_HORIZONTAL );
$finala = imagerotate($finala, -60, imageColorAllocateAlpha($finala, 0, 0, 0, 127));
imagecopyresampled($finalb, $finala,-$w*0.1,-$h*0.1,0,$h*0.20, $new_width, $new_height, $w, $h);
header('Content-Type: image/jpeg');
imagejpeg($finalb);
imagedestroy($finala);
imagedestroy($image2);
imagedestroy($image1);
imagedestroy($final);