我目前使用以下功能创建并保存自定义图像。这完美地运行并将图像保存到我的服务器。
function merge($filename_x, $filename_y, $filename_result) {
// Get dimensions for specified images
list($width_x, $height_x) = getimagesize($filename_x);
list($width_y, $height_y) = getimagesize($filename_y);
// Create new image with desired dimensions
$image = imagecreatetruecolor($width_x + $width_y, $height_x);
// Load images and then copy to destination image
$image_x = imagecreatefromjpeg($filename_x);
$image_y = imagecreatefromgif($filename_y);
imagecopy($image, $image_x, 0, 0, 0, 0, $width_x, $height_x);
imagecopy($image, $image_y, $width_x, 0, 0, 0, $width_y, $height_y);
// Save the resulting image to disk (as JPEG)
imagejpeg($image, $filename_result);
// Free memory
imagedestroy($image);
imagedestroy($image_x);
imagedestroy($image_y);
}
使用:
$img1 = '/folder1/folder2/image1.gif';
$img2 = '/folder1/folder2/image2.gif';
$destination = '/dirabc/dirdef/finalImage.jpeg';
merge($img1 , $img2 , $destination );
问题是,如何将此图像保存到我拥有的另一台服务器上?