我有以下代码:
$animation = 'animation.gif';
$watermark = 'watermark.jpg';
$watermarked_animation = 'watermarked.gif';
$cmd = "$animation -extent 400x255 -coalesce -gravity southwest -geometry +0+0 null: $watermark -layers composite -layers optimize";
exec("convert $cmd $watermarked_animation", $output);
print_r($output);
我想将图像字符串输出到 stdout 而不是将其保存到文件中?
我怎样才能做到这一点?
提前谢谢你!
您是否尝试过在目标文件名的位置放置连字符?为我工作,但是没有使用您更复杂的文件名对其进行测试..
因此,例如,这很好用:
convert test.jpg -size 50x50 -
要处理字符集,请尝试一下:
exec('LANG='"en_US.UTF8'" convert test.jpg -size 50x50 -');
您也可以尝试这种方式。
$im = new Imagick('image.jpg');
header("Content-type: image/jpeg");
$output = (string) $im;
echo $output;