3
This is more of a curiosity, I did a quick search and did not find something to explain how it works.
In practice when we develop, we have some methods to request an image from the server and display it on the browser screen in the client. One way depending on the case can be good to use, which is to leave the converted image in Base64, there are people who do not like it so, I believe that this way is good to use small images, decreasing the amount of files in the directories. Google images works that way, Whats emoticons app version web also works like this.
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"></img>
The other, more traditional way is to fill the src
with the path of the locality of the image. And then the curiosity arises, what method used by the server to convert the image to send it to the client (browser/browser)?
example:
<img src="img/imagem.png"></img>
At first, there is no conversion at all - either the image exists on the server with the requested name, or it does not exist; and regardless of the name, the server can specify the format in the mime type and/or the browser can inspect the image to discover its contents (I don’t know exactly what happens when the mime type does not match the file format). By the way, Base64 increases data size by 33, not being a good option for large files, but as you actually pointed out to small files saves a round-trip to the server.
– mgibsonbr
I think he wanted to use some other term instead of the word "convert".. that word changes the whole meaning of the question...
– Daniel Omine
commenting a little more, part of the description of the question already answers the question itself.. rsrsr.. this scheme applying data:image is more for small images. Imagine 50 small images on a single page. That’s 50 requests to the server.. In a high traffic service, this becomes a significant cost $$.
– Daniel Omine
Um yes, so each image has a new request to the server. My question is just how the server sends the image in the normal request as given in the example, is it in byte array? or some other type of data ? is more a curiosity.
– Skywalker