PostgreSQL has this datatype called bytea. It is their version of a blob.
In displaying images, png/jpg/gif, the current trend nowadays is to use Data URLs.
My question is how to convert a bytea value into a Base64 Data URL value?
You may also fetch the complete image data URL from your database, e.g.:
SELECT 'data:image/gif;base64,' || encode(image_data, 'base64') AS image_url
FROM ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With