这有效:
$img = imagecreatefromstring(base64_decode(str_replace('data:image/png;base64,', '', $image)));
$width = imagesx($img);
$height = imagesy($img);
$output = imagecreatetruecolor($width, $height);
$white = imagecolorallocate($output, 255, 255, 255);
imagefilledrectangle($output, 0, 0, $width, $height, $white);
imagecopy($output, $img, 0, 0, 0, 0, $width, $height);
imagejpeg($output, './'.$filename);
echo $filename;
但我想在此图片下添加背景图片,我可能会使用imagecreatefromjpeg("bg.png")
搜索但我该如何实现?
答案 0 :(得分:0)