简体   繁体   English

我可以将图像从base64转换为二进制客户端吗?

[英]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 我想避免

  1. a round trip to the server and 往返服务器和
  2. Sucking the server's RAM into a GD process. 将服务器的RAM吸入GD进程。

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.

相关问题 如何在客户端 javascript 中将 .wav 文件从 url 转换为 base64? - how can i convert .wav file from url to base64 in client-side javascript? 如何在客户端将下载的嵌入式图像转换为Base64 - How convert downloaded inline image into Base64 on client side 在客户端上传图像并将其转换为base64以生成html - Upload image at client side and convert it to base64 for generating html 是否可以将图像从外部源转换为base64字符串客户端? - Is it possible to convert an image from an external source to a base64 string client side? 如何将图像缓冲区转换为字符串 base64? - How can I convert image buffer to string base64? 如何将Base64图像转换为文件类型 - How can I convert Base64 image to file type 将二进制 PDF Stream 转换为 base64(服务器端) - Convert Binary PDF Stream, to base64 (server side) 如何从图像源将图像转换为 Base64 字符串? - How can I convert an image into Base64 string from an image source? 加载远程映像,然后转换为Base64字符串客户端进行缓存 - Load Remote Image, then Convert to Base64 String Client Side for Caching 如何使用 Cloudinary 客户端将 Blob URL 转换为 Base64 字符串并检索图像 URL? - How to convert Blob URL to Base64 string and retrieve an Image URL using Cloudinary Client-Side?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM