我有我的网站徽标,我想在上传时将其放到图像底部。第一步是填充白色背景(高度为70px),然后将徽标放在左下角。我怎样才能做到这一点 ? 例如;
答案 0 :(得分:0)
<?php
function merge($filename_x, $filename_y, $filename_result) {
list($width_x, $height_x) = getimagesize($filename_x);
list($width_y, $height_y) = getimagesize($filename_y);
$image = imagecreatetruecolor($width_x, $height_y + $height_x);
$image_x = imagecreatefromjpeg($filename_x);
$image_y = imagecreatefrompng($filename_y);
$white = imagecolorallocate($image, 255, 255, 255);
imagefill($image, 0, 0, $white);
imagecopy($image, $image_x, 0, 0, 0, 0, $width_x, $height_x);
imagecopy($image, $image_y, 0, $height_x, 0, 0, $width_y, $height_y);
imagejpeg($image, $filename_result);
imagedestroy($image);
imagedestroy($image_x);
imagedestroy($image_y);
}
merge('image.jpg', 'simge.png', 'merged.jpg');