안드로이드 Firebase Image Upload 시에 용량 줄일려면 어떻게 해야 하나요??
private void galleryAddPic()
{
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
Bitmap bitmap = BitmapFactory.decodeFile(mCurrentPhotoPath);
ByteArrayOutputStream baos=new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 80, baos);
byte [] b=baos.toByteArray();
String temp= Base64.encodeToString(b, Base64.DEFAULT);
File filePath = new File(temp);
Uri pathUri = Uri.fromFile(filePath);
intent.setData(pathUri);
this.sendBroadcast(intent);
// ------------------------------------------------------------- image Upload
Log.i("Upload", "Upload Start");
storageRef = storage.getReferenceFromUrl("gs//:").child("images/"+imageFileName);
storageRef.putFile(pathUri)
.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
@SuppressWarnings("VisibleForTests") Uri downloadUrl = taskSnapshot.getDownloadUrl();
if(downloadUrl == null)
{
Toast.makeText(MainActivity.this, "Downlaod Data Null", Toast.LENGTH_SHORT).show();
}
// downloadImageFile();
Log.i("File Upload","File Upload Success");
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
Log.i("File Upload","File Upload Failed");
}
});
}
이런식으로 만들었는데, Log.i("File Upload","File Upload Failed"); 를 보여주네요;;
Firebase Storage에 Image를 업로드 시킬 때 어떻게 해야 용량을 줄여서 올릴 수 있을까요??
답변 부탁드립니다!