如何使用json将图像发送到iPhone中的服务器?

时间:2022-12-01 16:13:00

I am using json to communicate with the server.

我正在使用json与服务器进行通信。

I want to post and grab an image from the server.

我想发布并从服务器中获取图像。

How to convert the image in json format to send it, also when we get an image in json format and convert it back to image.

如何以json格式转换图像以发送它,当我们获得json格式的图像并将其转换回图像时。

3 个解决方案

#1


4  

Please refer to the relevant section of the HTML spec for how to properly upload binary data.

有关如何正确上传二进制数据,请参阅HTML规范的相关部分。

JSON objects are posted using a very inefficient encoding for binary data. Utilizing the existing frameworks and standards for uploading binary data will save you a tremendous amount of time.

使用非常低效的二进制数据编码发布JSON对象。利用现有的框架和标准上传二进制数据将为您节省大量时间。

#2


1  

Image is binary - you would be probably better send link to the image in your JSON otherwise you need to deal with base64

图像是二进制的 - 您可能会更好地发送链接到JSON中的图像,否则您需要处理base64

#3


0  

I found this site to be very helpful: http://iphone.zcentric.com/2008/08/29/post-a-uiimage-to-the-web/

我发现这个网站非常有帮助:http://iphone.zcentric.com/2008/08/29/post-a-uiimage-to-the-web/

You don't really need json to send to the server; just standard iPhone SDK methods.

你真的不需要json发送到服务器;只是标准的iPhone SDK方法。

#1


4  

Please refer to the relevant section of the HTML spec for how to properly upload binary data.

有关如何正确上传二进制数据,请参阅HTML规范的相关部分。

JSON objects are posted using a very inefficient encoding for binary data. Utilizing the existing frameworks and standards for uploading binary data will save you a tremendous amount of time.

使用非常低效的二进制数据编码发布JSON对象。利用现有的框架和标准上传二进制数据将为您节省大量时间。

#2


1  

Image is binary - you would be probably better send link to the image in your JSON otherwise you need to deal with base64

图像是二进制的 - 您可能会更好地发送链接到JSON中的图像,否则您需要处理base64

#3


0  

I found this site to be very helpful: http://iphone.zcentric.com/2008/08/29/post-a-uiimage-to-the-web/

我发现这个网站非常有帮助:http://iphone.zcentric.com/2008/08/29/post-a-uiimage-to-the-web/

You don't really need json to send to the server; just standard iPhone SDK methods.

你真的不需要json发送到服务器;只是标准的iPhone SDK方法。