I am using Samsung A52 to take some images with camera not my firebase app and save them, after that i would upload these images to firebase, iam compressing them before upload .
now after images were uploaded i checked and found that they are -90 rotated, not all images rotated , some were rotated and some weren't;
any idea?
or is there any possibly to detect while loading images from firebase if it rotated to retotate is to 90 ?
function to upload images after getting them from gallery.
for (uploadCount = 0; uploadCount < ImageList.size(); uploadCount++) {
String imagePath = productRef.child(UID).child("images").push().getKey();
Uri IndividualImage = ImageList.get(uploadCount);
assert imagePath != null;
StorageReference ImageName = productImagesRef.child(UID).child(imagePath);
//Compress Images
Bitmap bmp = null;
try {
bmp = MediaStore.Images.Media.getBitmap(getContentResolver(), IndividualImage);
} catch (IOException e) {
e.printStackTrace();
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
assert bmp != null;
bmp.compress(Bitmap.CompressFormat.JPEG, 25, baos);
byte[] data = baos.toByteArray();
//End of compressing
//start on uploading compressed
ImageName.putBytes(data).addOnSuccessListener(taskSnapshot -> ImageName.getDownloadUrl()
.addOnSuccessListener(uri -> {
String url = String.valueOf(uri);
StoreLink(url, imagePath);
})).addOnProgressListener(snapshot1 -> {
double progress = (100.0* snapshot1.getBytesTransferred()/snapshot1.getTotalByteCount());
loadingDialog.setMessage("صورة رقم " + (count+ 1) + " -->> " +(int) progress + "%");
});
}