是否可以在单个 JSON 消息中将一组图像二进制文件返回到浏览器?
从上传的角度来看,我们可以使用 MIME multipart 在单个请求中携带多个文件。我想知道 Web 服务器是否可以通过单个 JSON 消息将一组图像(二进制文件)返回到客户端的浏览器?如果是这样,浏览器是否可以通过使用标签检索多个图像来进行解复用和渲染?
请指教。
谢谢&问候, 威廉
From the point of view of uploading, we can use MIME multipart to carry multiple files within a single request. I'm wondering if it is possible for a web server returning set of images (binaries) through a single JSON message to the browser at the client side? If so, is it able to be demuxed and rendered by the browser as retrieving multiple images by using tags?
Please advise.
Thanks & regards,
William
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用base64对图像进行编码并包含在json中。然后使用数据方案 URI 来检索图像。
有关数据方案 URI 的更多信息。
http://en.wikipedia.org/wiki/Data_URI_scheme
You can use base64 to encode the image and included in json. Then use data scheme URI to retrive the image.
More about data scheme URI.
http://en.wikipedia.org/wiki/Data_URI_scheme