【发布时间】:2012-06-27 17:57:58
【问题描述】:
我想将画布保存为 PNG,而不是在新窗口中将其作为 base64 编码图像打开。
我使用了这个代码:
jQuery("#btnPreview").click(function(){
if (!fabric.Canvas.supports('toDataURL')) {
alert('Sorry, your browser is not supported.');
}
else {
canvas.deactivateAll();
canvas.forEachObject(function(o){
if(o.get("title") == "||Watermark||"){
canvas.bringToFront(o);
}
});
window.open(canvas.toDataURL('png'), "");
canvas.forEachObject(function(o){
if(o.get("title") == "||Watermark||"){
canvas.sendToBack(o);
}
});
canvas.renderAll();
}
});
我想让按钮将图像保存为 PNG 或 JPG。
【问题讨论】:
-
我不认为这是这个问题的重复。
-
我不认为我正在寻找的东西 :(
-
我想将画布保存为“png”,而不是在新窗口中将其作为 base64 编码图像打开。我想让按钮将图像保存为“png”或“jpg”,我很清楚
-
无论如何都要通过PHP下载
标签: javascript html canvas fabricjs