【发布时间】:2013-11-22 10:32:10
【问题描述】:
我将“chartdiv00” div 作为图像附加到“imgChart1” div。
LoadImage = function(){
var imgData = $('#chartdiv00').jqplotToImageStr({});
var imgElem = $('<img/>').attr('src',imgData);
$('#imgChart1').append(imgElem);
}
然后我想要通过单击按钮将“imgChart1”div 的图像下载为 png 或 jpg。我怎么能那样做? 我可以在 HTML5 中使用下载属性吗? 那么我的图片的网址是什么? 如果我可以将图像转换为 dataURI,我想我可以下载它。有没有办法将这种图像转换为 dataURI ?
谢谢
【问题讨论】:
-
你在 imgData 中得到了什么?
-
@writeToBhuwan 我正在使用 jqplot 绘制图表,我想下载该图表。 img 数据与 jqplot 图像组成。
标签: javascript jquery html uri