我试过这个代码片段:
if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_CAMERA) {
photoUri = capturedImagePath();
Log.d("path to captured image", capturedImagePath().toString());
Bitmap aBitmap = BitmapFactory.decodeFile(photoUri.toString());
mProfilePic.setImageBitmap(aBitmap);
mEncodedImageString = convertBitmapToString(aBitmap);
Log.v("Base64 Image String : ", mEncodedImageString);
} else if (requestCode == SELECT_FILE) {
photoUri = data.getData();
String[] filePathColumn = {
MediaStore.Images.Media.DATA
};
Cursor cursor = getContentResolver().query(photoUri, filePathColumn, null, null,
null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
Bitmap aBitmap = BitmapFactory.decodeFile(picturePath);
mProfilePic.setImageBitmap(aBitmap);
mEncodedImageString = convertBitmapToString(aBitmap);
Log.v("Base64 Image String : ", mEncodedImageString);
}
}
获取图像路径,但它给了我原始图像。我想要的是所选图像的缩略图。谁能帮我实现同样的目标?