[英]How to open a new page with data url image?
I'm working with literallyCanvas which is the export button will open a new page with data url of the image edited. 我正在使用literallyCanvas ,这是导出按钮,它将打开一个新页面,其中包含编辑图像的数据URL。 But I need to change the way it open a new page from an image to a page with var. 但是我需要将其打开新页面的方式从图像更改为带有var的页面。
This is the original code from source which is open a new page with image: 这是源代码中的原始代码,它将用图像打开一个新页面:
$("#open-image").click(function() {
window.open(lc.getImage({
rect: {x: 0, y: 0, width: 1200, height: 800},
scale: 1
}).toDataURL());
});
So, I tried to change the structure with page name in it, and I've got: 因此,我尝试更改其中带有页面名称的结构,并且得到:
$("#open-image").click(function() {
window.open('preview.php?img='+lc.getImage({rect: {x: 0, y: 0, width: 1200, height: 800},scale: 1})).toDataURL();
});
But it makes my browser frozen. 但这会使我的浏览器冻结。 I can't do anything but force it to close and open it again. 除了强制关闭并再次打开外,我什么也不能做。 I really want this button #open-image to open a new page like preview.php?img=apaosidfjskf(123asdfpoa$sldkjfwepfaoASfweas
. But it gives me this instead preview.php?img=[object HTMLCanvasElement]
我真的希望此按钮#open-image打开一个新页面,如preview.php?img=apaosidfjskf(123asdfpoa$sldkjfwepfaoASfweas
。但是它给了我相反的preview.php?img=[object HTMLCanvasElement]
Please suggest me if there's anything I'm done wrong or enlighten me to the solution. 如果我做错了任何事情,请给我建议,或者启发我解决方案。
Looks like you have a typo 看起来你有错字
$("#open-image").click(function() {
window.open('preview.php?img=' + lc.getImage({
rect: { x: 0, y: 0, width: 1200, height: 800 },
scale: 1
}).toDataURL()); // This line has been corrected
});
That should fix the preview.php?img=[object HTMLCanvasElement]
problem 那应该可以解决preview.php?img=[object HTMLCanvasElement]
问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.