だから、私は人々がAJAX経由で画像をアップロードできるフォームを持っています. 画像がアップロードされると、リストから別の画像 (.png) を選択して、最初の画像にドラッグ アンド ドロップできます。
結果に満足したら、ボタンを押すと両方の画像が結合されます。2番目の画像(アップロードされた画像にドラッグアンドドロップできる画像)のサイズを変更する機会を与えたいと思うまで、これは位置があってもうまくいきました。
私が今持っているコードは、小さな画像のサイズ変更が機能しません。実際、アップロードされた画像 (背景画像) の上には表示されません。ここで何が欠けていますか?
//receiving some values from an AJAX call
//those values referes to the background image
$pathToImage = $_POST['pathToImage'];
$posBg = $_POST['posBg'];
$fileUploaded = '../'.$pathToImage;
//those values referes to the image that goes on top of the background
$posTop = $_POST['posTop'];
$posLeft = $_POST['posLeft'];
$itemWidth = $_POST['itemWidth'];
$fileChupon = '../images/chupon1.png';
//my target file
$targetfile = "../images/galeria/testing".time().".png";
//here's the issue.. I am trying to resize the small image that goes on top of the background - this doesn't work and with this piece of code nothing is shown on top of the background
$chuponCreated = imagecreatefrompng($fileChupon);
$newWidth = $itemWidth;
$newHeight = $itemWidth;
$tmp = imagecreatetruecolor($newWidth,$newHeight);
$chupon = imagecopyresampled($tmp, $chuponCreated,0,0,0,0,$newWidth,$newHeight,250,250);
//background image is shown in the dimensions that it's supposed to
$fondo = imagecreatefromjpeg($fileUploaded);
$fondoW = imagesx($fondo);
$fondoH = imagesy($fondo);
$photoFrame = imagecreatetruecolor($fondoW,303);
imagecopyresampled($photoFrame,$fondo,0,$posBg,0,0,$fondoW,$fondoH,$fondoW,$fondoH);
//here trying to add the small image over the background
imagecopy($photoFrame,$chupon,$posLeft,$posTop,0,0,$itemWidth,$itemWidth);
imagejpeg($photoFrame, $targetfile);
$imgPath = $targetfile;
$image = imagecreatefromjpeg($imgPath);
imagejpeg($image);
前もって感謝します!