I have a Web application as well as Andriod app.I want to store the User profile picture in database.Can Anybody Suggest me which is the best and secure way to store image,so that 1. I should be able to access profile picture for the android app. 2. I should be able to retrieve the image for my web application also.
Asked
Active
Viewed 47 times
1 Answers
0
You could use the base64_encode-function of PHP:
http://php.net/manual/de/function.base64-encode.php
Then save the base64-code to database.
Android (which is Java) is able to decode the base64-Code.
Here is an example:
$imageData = file_get_contents('path/to/image');
$base64Image = base64_encode($imageData);
// save base64Image to database

Oliver
- 893
- 6
- 17
-
problem in base64 is that I'm using Dropzone.js to upload file.To edit profile picture I'm not able to display the preview in dropzone. – Arun A T Oct 21 '16 at 13:01