Hello.
Tell me how to save images in a MySQL database?
There is no “image” data type in phpMyAdmin.
Hi, two ways come to mind
- Datatype BLOB – and encode in Base64 format.
- Don’t, store the image in a file on the server and just point to it’s url.
Cheers, John
Hi.
- How to encode in Base64 format.
- I didn’t understand the second method at all.
Hi, there are a number of plugins that you can use to convert an image file to Base64, some are free.
FYI: One issue you will face with storing image data in the database is speed of loading. Each image that is being returned must be read from the database, and this is typically serial. When images are stored in files and loaded via URL the browser can load them in parallel. So loading several images can be done all at the same time. Loading from the database can (not always) cause the browser to load one at a time.
FYI; Not proposing method 2 if you do not have experience with writing APIs.
The second method is the method Bubble actually uses. When you upload an image it is placed on the AWS server, then the workflows and elements only references it by URL. The actual image data is not automatically stored in the Bubble database. However, this method although efficient has technical issues. If you are planning on storing images on you own server, then you will have to write your own API to create a code endpoint that you can then “send” the image from bubble to your server - then you can store the URL in the Bubble database. Of course this means that you need to have a good understanding of code such as PHP and likely Linux security to ensure that files are secure.
The solution we actually proceeded with is to use a third party storage service - Wasabi which is not very expensive (compared to AWS) and already has all the security features.
Cheers,
John
Can you tell me where the query syntax information can be viewed?
Sorry, not sure what you mean?
John