mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-04-17 15:14:55 +08:00
Try to use realpath filename instead of default modified.jpg
This commit is contained in:
parent
a030c52f7f
commit
dbe3e3d2ca
@ -508,9 +508,15 @@ private void refreshGallery(Uri contentUri)
|
|||||||
|
|
||||||
|
|
||||||
private String ouputModifiedBitmap(Bitmap bitmap, Uri uri) throws IOException {
|
private String ouputModifiedBitmap(Bitmap bitmap, Uri uri) throws IOException {
|
||||||
// Create an ExifHelper to save the exif data that is lost during compression
|
// Some content: URIs do not map to file paths (e.g. picasa).
|
||||||
String modifiedPath = getTempDirectoryPath() + "/modified." +
|
String realPath = FileHelper.getRealPath(uri, this.cordova);
|
||||||
(this.encodingType == JPEG ? "jpg" : "png");
|
|
||||||
|
// Get filename from uri
|
||||||
|
String fileName = realPath != null ?
|
||||||
|
realPath.substring(realPath.lastIndexOf('/') + 1) :
|
||||||
|
"modified." + (this.encodingType == JPEG ? "jpg" : "png");
|
||||||
|
|
||||||
|
String modifiedPath = getTempDirectoryPath() + "/" + fileName;
|
||||||
|
|
||||||
OutputStream os = new FileOutputStream(modifiedPath);
|
OutputStream os = new FileOutputStream(modifiedPath);
|
||||||
CompressFormat compressFormat = this.encodingType == JPEG ?
|
CompressFormat compressFormat = this.encodingType == JPEG ?
|
||||||
@ -520,8 +526,7 @@ private String ouputModifiedBitmap(Bitmap bitmap, Uri uri) throws IOException {
|
|||||||
bitmap.compress(compressFormat, this.mQuality, os);
|
bitmap.compress(compressFormat, this.mQuality, os);
|
||||||
os.close();
|
os.close();
|
||||||
|
|
||||||
// Some content: URIs do not map to file paths (e.g. picasa).
|
// Create an ExifHelper to save the exif data that is lost during compression
|
||||||
String realPath = FileHelper.getRealPath(uri, this.cordova);
|
|
||||||
ExifHelper exif = new ExifHelper();
|
ExifHelper exif = new ExifHelper();
|
||||||
if (realPath != null && this.encodingType == JPEG) {
|
if (realPath != null && this.encodingType == JPEG) {
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user