chmod($fileOutName, 0775); $fileHandle = fopen($fileOutName, "w"); if ($fileHandle) { fwrite($fileHandle, $binaryDataValue); fclose($fileHandle); echo "saved"; } } } else { if (false) { // create canvas $canvasWidth = 1024; $canvasHeight = 128; $canvasFileName = "./temp/" . "canvas.png"; $result = createBlankImage($canvasWidth, $canvasHeight, $canvasFileName); echo "RESULT:\n"; echo "'" . $result . "'"; } else { // combine images $offsetX = 110; $offsetY = 120; $imageOver = "iso_gnd_stone.png"; $imageBase = "./temp/" . "canvas.png"; $outFileName = "./temp/" . "canvas2.png"; $result = combineImageOntoImage($imageOver, $offsetX, $offsetY, $imageBase, $outFileName); $actual_link = requestedServerURL(); $actual_link = preg_replace("/" . $THIS_FILE_NAME . "/", "", $actual_link); $actual_link = $actual_link . "" . $outFileName; echo $actual_link; } }
// COMBINE IMAGES INTO GRID $len = sizeof($imageGridFileList); $imageGridFinalLocation = "./temp/" . "grid.png"; // get final image size $fullGridSizeX = 0; $fullGridSizeY = 0; for ($i = 0; $i < $len; ++$i) { $imageObject = $imageGridFileList[$i]; $filename = $imageObject["filename"]; $imageWidth = $imageObject["width"]; $imageHeight = $imageObject["height"]; $offsetX = $imageObject["x"]; $offsetY = $imageObject["y"]; $fullGridSizeX = max($fullGridSizeX, $offsetX + $imageWidth); $fullGridSizeY = max($fullGridSizeY, $offsetY + $imageHeight); } echo "<br/>GRID SIZE: " . $fullGridSizeX . ", " . $fullGridSizeY . "<br/>"; createBlankImage($imageGridFinalLocation, $fullGridSizeX, $fullGridSizeY); echo "<br/>" . $imageGridFinalLocation; // combine cells for ($i = 0; $i < $len; ++$i) { $imageObject = $imageGridFileList[$i]; $filename = $imageObject["filename"]; $imageWidth = $imageObject["width"]; $imageHeight = $imageObject["height"]; $offsetX = $imageObject["x"]; $offsetY = $imageObject["y"]; combineImageOntoImage($filename, $offsetX, $offsetY, $imageGridFinalLocation, $imageGridFinalLocation); } //combineImageOntoImage($imageOver, $offsetX, $offsetY, $imageBase, $outFileName) }