No need to encode a base64 image. MySQL is very good at storing binary data. Just make sure you use the blob field type, not text. text fields are subject to a character set, which can ruin your .png data. Blob fields are not translatable.
In addition, base64 encoding increases text size by about 35%, so you're wasting a big chunk of space without any benefits.
However, it is usually a bad idea to store images in a database. You have the advantage that the image is always โright thereโ, but it makes absolutely huge dumps during backup and all kinds of entertainment that try to get the image and display on your website.
it is invariably better to store it externally in a file with a name after the primary record key for easy access / verification.
source share