How do you save and retrieve image in mySQL?

Just wanted to know how will I be able to save and retrieve image in mySQL using PHP?
Note that the image is already on the app asset.

So, I tried if I could be able to retrieve the image without the used of BLOB in PHP or Base64, etc, I just followed the format on how I saved and retrieved texts and it worked also for the image that is saved on my asset.

Looks like you are saving the path to the image (as a string).

Most people would save the actual image to a separate directory on their server, then save the url / path for that in their mysql. Two operations needed.

Yes. Um, well it works for me, without doing what most people do, just hoping I won't encounter some problems on it in future. ^^"

You should bear in mind that that path, to a local image, will only work on the device of the user that posted the data. It is of no use to you as the mysql owner, or any other users. You may want to, in some way, share all the plants recorded at some point, amongst all users ? And what if your user uses a different device, no images....

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.