[英]Can I convert an image FROM base64 to binary client side?
After manipulating an image using a canvas element and then getting the result via canvasImg.toDataURL( "image/jpeg", 1.0 )
, is it possible to convert the result into a binary image file client-side? 在使用canvas元素操作图像然后通过
canvasImg.toDataURL( "image/jpeg", 1.0 )
获取结果后,是否可以将结果转换为客户端的二进制图像文件? I am trying to avoid 我想避免
The goal is to edit the image and get it onto s3 as a file without touching my server. 目标是编辑图像并将其作为文件放到s3而不触及我的服务器。
Daniel C 's comment led me to the solution (here at Convert Data URI to File then append to FormData ). Daniel C的评论让我得到了解决方案(这里将Convert Data URI转换为File然后附加到FormData )。
The one extra thing I needed was URL.createObjectURL(blob)
, which gave me a string handle to pass the file around. 我需要的另外一件事是
URL.createObjectURL(blob)
,它给了我一个字符串句柄来传递文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.