Obtain binary access images in MySQL. only the first image can be output, and the result cannot be output cyclically ?? The image is saved to the database in binary format, and the first image can be output in the browser without the while loop. after it is used, the output is garbled, is there no output before the output image ?? I checked a lot and it didn't work. could you please advise PHPcode & lt ;? Phprequire_once (& quot; obtain the binary access image in MySQL. only the first image can be output, but cannot be output cyclically ??
The image is saved to the database in binary format, and the first image can be output in the browser without the while loop. after it is used, the output is garbled, is there no output before the output image ??
I checked a lot and it didn't work. please give me some advice.
PHP code
------ Solution --------------------
In other words, Content-Type: image/jpeg declares that the response Content is a byte stream. Your code also outputs the ghost stream, which naturally leads to the inability of the browser to accurately identify and convert the code.
To display multiple images in a browser, you must follow the HTML format standard. The src attribute of the img tag supports various protocols, such as file: // http: // data: //, but cannot be directly filled with the byte stream of the image.
I still hope you will not be hanging on this tree. You can use this meaningless and unreasonable project to train your hands. not only will you not gain anything, but it will make you learn more and more confused.
------ Solution --------------------
My previous understanding of streaming is also problematic. if you have time, please refer to the correct explanation:
Mime type definitions declared by http://zh.wikipedia.org/zh/MIME Content-type
If the content-type is image/jpeg, the subsequent response content can only be understood as a jpeg image.
However, if the response content is text/html, the browser will parse the content as an HTML document. the HTML tag has its own meaning, and the img tag will be used for displaying the image, the src attribute specifies where the image is loaded.
Http: // The url followed by the request is required to be downloaded from the server. this will initiate another request.
File: // The file address is specified to be read from the local file system, which can only read local files.
Data: // see rfc2397 for texts in special formats.