Am encoding an image from android to base64 with this code:
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 90, stream); //compress to which format you want.
byte [] byte_arr = stream.toByteArray();
image_str = Base64.encodeToString(byte_arr, Base64.DEFAULT);
and than insert it into mysql data base, than decode it with php using that code:
$filename_path = md5(time().uniqid()).".jpeg";
$decoded=base64_decode($image_str);
file_put_contents("uploads/".$filename_path,$decoded);
//echo '<img src="uploads/".$filename_path"/>';
echo '<img src="uploads/'.$filename_path.'"/>';
it's working all fine i can see the picture and there is no errors, but the problem is am losing like about 80% of the quality and the size , how can i fix that please.