-1

I don't understand the items in the following code meant for displaying image

<img src="data:image/jpeg;base64,' .  base64_encode($data)  . '" />
  • Welcome to Stack Overflow. Please take the [tour] to learn how Stack Overflow works and read [ask] on how to improve the quality of your question. Then check the [help/on-topic] to see what questions you can ask. Please see: [Why is “Can someone help me?” not an actual question?](https://meta.stackoverflow.com/q/284236). – Progman Oct 04 '20 at 17:04
  • [How to render base-64 string in tag without knowing extension](https://stackoverflow.com/questions/41136119/how-to-render-base-64-string-in-img-tag-without-knowing-extension), [img url from base 64 data javascript](https://stackoverflow.com/questions/27670843/img-url-from-base-64-data-javascript), [Encode image file to base 64](https://stackoverflow.com/questions/41462036/encode-image-file-to-base-64) – Y2020-09 Oct 04 '20 at 21:34
  • Does this answer your question? [Base64 Encoding Image](https://stackoverflow.com/questions/35879/base64-encoding-image) – 404 - Brain Not Found Oct 05 '20 at 02:34
  • You have tagged this with java, but this looks more like PHP to me. – Mark Rotteveel Oct 07 '20 at 20:08

1 Answers1

0

When an image's link starts with a data:, it means the image is loaded into the page from a MySQL Database. The image gets directly added to the page from the Server's SQL Database and not via a picture file in the server.

  • That's not the complete story. When there is a `SRC="data:..."` what it means is that the image-file, itself, is converted into what is known as **Base 64 Encoding** - _which encodes the `bytes` of the **image-file** into a subset of the **ASCII** character set_ so that they may be 'printed' into an `'.html' File`. There are numerous Stack Overflow Answers about Base-64 Image Encodings inside of `'.html' Files.` Just do an SO Search for "Base-64 IMG Element". Also, the **image-file** is being loaded from some where, but that could easily be Java-Script, among other loading sources. – Y2020-09 Oct 04 '20 at 21:31