$dest = @imagecreatefrompng(base_url().'assets/images/card-design-3-backside.png');
$src = @imagecreatefrompng(base_url().'assets/images/card-design-3-ackside.png);
$sj = imagecopymerge($dest, $src, 845, 280, 0, 0, 200, 200, 100);
header('Content-Type: image/png');
imagepng($dest);
imagedestroy($dest);
imagedestroy($src);
答案 0 :(得分:2)
如果要将图像保存到文件,只需将第二个参数添加到imagepng()函数即可。像这样:
app/build/reports/coverage/debug/index.html
不要添加标题,因为我们不想输出到浏览器。
答案 1 :(得分:0)
大概你的意思是保存到磁盘或下载。从手册:
保存到磁盘(在服务器上):
<?php
// Create a destination
$dest = 'new/spot/new_name.png';
// Get contents from original spot
$im = imagecreatefrompng("https://www.fagario.com/skins/by-hacker.png");
// Save to disk in the new spot and name
imagepng($im,$dest);
// Destroy image
imagedestroy($im);
下载(到本地):
<?php
$dest = "name.png";
// Get contents from original spot
$im = imagecreatefrompng("https://www.fagario.com/skins/by-hacker.png");
header('Content-Disposition: Attachment; filename='.$dest);
// Create the proper file type header
header('Content-Type: image/png');
imagepng($im);
// Destroy image
imagedestroy($im);
现在浏览器(无需下载或保存):
<?php
// Get contents from original spot
$im = imagecreatefrompng("https://www.fagario.com/skins/by-hacker.png");
// Create the proper file type header
header('Content-Type: image/png');
imagepng($im);
// Destroy image
imagedestroy($im);