How to read images from MySQL database using PHP?
If the images are stored in a BLOB in the database, how to use the binary data that I get and turn it into an image
To directly use the binary data as a an image source, you can use the data URI scheme, for example:
$uri = 'data:image/png;base64,'.base64_encode($row['binary-data']);
This URI can then be used directly as the image’s source:
background-image: url()
But that has some substantial disadvantages: Besides the lack of support for these data URIs in older browsers, data URIs do also have disadvantaged regarding payload, caching, and references.