-2
A
回答
0
试试这个How to access the <img /> in document from iframe?
$('#Iframe1').contents().find('img').css({'width':'100%','height':'90%'});
,然后使用此功能从这里Get image data in JavaScript?
function getBase64Image(img) {
// Create an empty canvas element
var canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
// Copy the image contents to the canvas
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0);
// Get the data-URL formatted image
// Firefox supports PNG and JPEG. You could check img.src to
// guess the original format, but be aware the using "image/jpg"
// will re-encode the image.
var dataURL = canvas.toDataURL("image/png");
return dataURL.replace(/^data:image\/(png|jpg);base64,/, "");
}
+0
非常感谢您的回答,但是当我尝试这样做时:var image = $('#Iframe1')。contents()。find('img'); (“Base64”+ current.getBase64Image(image));我有错误“提供的值不是一种HTMLImageElement” –
+0
注销图像的值,告诉我它是什么 –
相关问题
- 1. 将Base64编码图像加密为另一个有效的Base64编码图像
- 2. Base64编码图像
- 3. Base64编码图像
- 4. Amazon S3的URL编码
- 5. 将base64字符串保存到Amazon S3
- 6. 验证Base64编码图像
- 7. PHP Alter Base64编码图像
- 8. 验证base64编码图像
- 9. base64编码图像大小
- 10. Phonegap编码图像base64
- 11. Amazon s3 URL +正在编码为%2?
- 12. ASP.NET MVC - 将图像上传到Amazon S3
- 13. scrapy将图像存储到Amazon S3
- 14. 将图像上传到Amazon S3
- 15. 如何将图像传输到Amazon S3
- 16. 将base64编码的图像发送到损坏的图像
- 17. Base64编码为base64,
- 18. 实时图像从Amazon S3
- 19. Amazon S3图像托管Shopify
- 20. 服务器端D3 - SVG编码为Base64编码的图像
- 21. 将base64数据解码为图像
- 22. 将图像作为base64编码的bytearray或其路径传递
- 23. phonegap:无法将图像编码为android 2.3上的base64
- 24. 将ASW S3上的.tif图像转换为base64字符串C#
- 25. base64将clob编码为blob
- 26. 如何仅使用JavaScript将base64编码图像数据上传到S3?
- 27. java.lang.OutOfMemoryError编码位图为Base64
- 28. UIImage视图编码为base64
- 29. 使用javascript编辑base64编码图像
- 30. 如何将base64编码数据转换为xcode图像
的可能的复制[获取在JavaScript中的图像数据?](http://stackoverflow.com/questions/ 934012/get-image-data-in-javascript) –
除了要求别人为你做你的工作之外,你还试过了什么?为什么它不起作用? –