如何使用 WebAPI 处理图像 [英] How to handle Images using WebAPI
问题描述
问题
向我的服务发布/获取图像有哪些不同的方式?我想我可以在 JSON 中使用 Base-64 文本,也可以保持原生二进制.我的理解是,通过将图像转换为文本,包大小会显着增加.
What are the different ways to POST/GET images to my service? I think I can either use Base-64 text in JSON or stay native as binary. My understanding is that by converting the image into text, there is a significant increase is package size.
如果我发送图像(来自 Web 表单、本机客户端、其他服务),我应该添加图像控制器/处理程序还是使用格式化程序?这甚至是一个非此即彼的问题吗?
If I send the image (from a web form, from a native client, from another service), should I add a Image Controller/Handler or use a Formatter? Is this even an either/or question?
我研究并发现了许多相互竞争的例子,但我不确定我应该朝哪个方向发展.
I have researched and found many competing examples but I am not sure which direction I should be heading.
是否有网站/博客文章列出了这方面的利弊?
Is there a site/blog article that lays out the pros and cons for this?
推荐答案
我做了一些研究,你可以在这里看到我想出的实现:http://jamessdixon.wordpress.com/2013/10/01/handling-images-in-webapi/
I did some research and you can see the implementation I came up with here: http://jamessdixon.wordpress.com/2013/10/01/handling-images-in-webapi/
这篇关于如何使用 WebAPI 处理图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!