In development, a certain interface on the android side needs to display pictures, how should the background provide an interface to it, is it to return the picture address? Or return the file stream of the picture?

question: I am a java background programmer, responsible for providing interfaces to APP calls. Now a certain interface on the app side needs to display some pictures, and these pictures are stored in the database as a byte array (binary), so how should I provide an interface to the app side? Return the byte array of the picture and let android convert it to the picture itself? I hope those great gods who have written the interface to the app end will give some suggestions, thank you very much!

Apr.26,2022

Why is it in the binary content of the data inventory file?
that the receptionist sent dozens of M to the front desk can't get down? The
solution is returned after base64. Or use page routing to display binary content directly and declare content-type


in the returned header.
toss about.
  1. to define the picture request URL, you can consider customizing the image access path, then stitching the ID of the picture in the database, and finally completing the picture type (JPG/PNG), e.g. http://192.168.1.1/image/1.jpg
  2. after receiving the client request, if it conforms to the above URL format, the backend interface first parses the picture ID, then obtains the binary picture data from the database, and then returns a data structure that is the same as directly accessing the http-image file to the client.
  3. Image request URL is best guaranteed to be unique, and the suffix has been completed, which is convenient for the client to process, e.g. Cache picture data.

example: http://img.dongcoder.com/up/i...

HTTP request data is as follows:

HTTP/1.1 200 OK
Date: Mon, 21 Jan 2019 01:40:13 GMT
Content-Type: image/png
Content-Length: 32657
Accept-Ranges: bytes
Vary: Accept-Encoding

JFIF``C


this is a standard http-image data. Notice Content-Type: image/png and JFIF . Next, let's make our own Baidu http agreement.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b996-2ba24.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b996-2ba24.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?