解码从Android发送的图像后,图像大小在php中增加

I am sending the image from android as base64 string to PHP. After decoding the image in PHP the size of image is increased. For example the size of the image is 60kb then after decoding in PHP it becomes 200kb. How to maintain the same file size even in PHP.

$rimage=$_POST['profile'];
$decodedImage = base64_decode($rimage);  

Am directly store the $decodeImage into the folder. I've tried using the imagecreatefromstring($decodedImage) but this doesn't solve the problem.

Android code for converting image into base64 string

public String getStringImage(Bitmap bmp) throws UnsupportedEncodingException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    bmp.compress(Bitmap.CompressFormat.JPEG, 100, baos);
    byte[] imageBytes = baos.toByteArray();
    return Base64.encodeToString(imageBytes, Base64.DEFAULT);
}

After this i am sending it to the PHP server using Volley.

Problem Solved by using the below code instead of the above which recompress the image again.

  InputStream inputStream = new FileInputStream(fileName);//You can get aninputStream using any IO API
  byte[] bytes;
  byte[] buffer = new byte[8192];
  int bytesRead;
  ByteArrayOutputStream output = new ByteArrayOutputStream();
  try {
   while ((bytesRead = inputStream.read(buffer)) != -1) {
   output.write(buffer, 0, bytesRead);
  }
  } catch (IOException e) {
  e.printStackTrace();
  }
  bytes = output.toByteArray();
 String encodedString = Base64.encodeToString(bytes, Base64.DEFAULT);