( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
/* $layer_x=$row['left']['desktop'];
$layer_y=$row['top']['desktop'];
$layer_w=$row['width'];
$layer_h=$row['height'];
$layeropacity=$row['deformation']['opacity'];
$layer_r=$row['deformation']['xrotate'];
$str = $row['image_url'];
$brand =basename($str);*/
$layer_x=20;
$layer_y=20;
$layer_w=400;
$layer_h=400;
$layeropacity=1;
$layer_r=0;
$str = "output.png";
$brand =basename($str);
$brand =basename($str);
$brand=explode('&', $brand);
$brand=$brand[0];
$imageFolder ="v/uploads/gthumbs/$brand";
$creationFunction = 'ImageCreateFromPng';
$outputFunction = 'ImagePng';
$doSharpen = FALSE;
$quality = round(10 - ($quality / 10));
$background2Rotation = (180+$brandr) + 180;
$brand = $creationFunction("$brand");
$foto2W = imagesx($brand);
$foto2H = imagesy($brand);
$background2W = $layer_w;
$background2H = $layer_h;
$background2TOP = $layer_y;
$background2LEFT= $layer_x;
$background2 = imagecreatetruecolor($background2W,$background2H);
$trans_colour = imagecolorallocatealpha($background2, 0, 0, 0, 127);
imagefill($background2, 0, 0, $trans_colour);
imagealphablending( $background2, false );
imagecopyresampled($background2, $brand, 0, 0, 0, 0, $background2W, $background2H, $foto2W, $foto2H);
/* $background2 = imagerotate($background2,$background2Rotation, -1,0);*/
/*after rotating calculate the difference of new height/width with the one before*/
$extraTop =(imagesy($background2)-$background2H)/2;
$extraLeft =(imagesx($background2)-$background2W)/2;
/*
if($ext=="png")
{$myOpacity = $row['deformation']['opacity']*100;
imagecopymerge($background, $background2,$background2LEFT-$extraLeft, $background2TOP-$extraTop, 0, 0, imagesx($background2), imagesy($background2),$myOpacity);
}
else
{
imagecopy($background, $background2,$background2LEFT-$extraLeft, $background2TOP-$extraTop, 0, 0, imagesx($background2), imagesy($background2));
}
*/
imagecopy($background, $background2,$background2LEFT-$extraLeft, $background2TOP-$extraTop, 0, 0, imagesx($background2), imagesy($background2));