@@ -691,15 +691,15 @@ private void processResultFromGallery(int destType, Intent intent) {
691691 String fileLocation = FileHelper .getRealPath (uri , this .cordova );
692692 LOG .d (LOG_TAG , "File locaton is: " + fileLocation );
693693
694- // If you ask for video or all media type you will automatically get back a file URI
695- // and there will be no attempt to resize any returned data
696- if (this .mediaType != PICTURE ) {
694+ String uriString = uri .toString ();
695+ String mimeType = FileHelper .getMimeType (uriString , this .cordova );
696+
697+ // If you ask for video or the selected file doesn't have JPEG or PNG mime type
698+ // there will be no attempt to resize any returned data
699+ if (this .mediaType == VIDEO || !(JPEG_MIME_TYPE .equalsIgnoreCase (mimeType ) || PNG_MIME_TYPE .equalsIgnoreCase (mimeType ))) {
697700 this .callbackContext .success (fileLocation );
698701 }
699702 else {
700- String uriString = uri .toString ();
701- // Get the path to the image. Makes loading so much easier.
702- String mimeType = FileHelper .getMimeType (uriString , this .cordova );
703703
704704 // This is a special case to just return the path as no scaling,
705705 // rotating, nor compressing needs to be done
@@ -709,12 +709,6 @@ private void processResultFromGallery(int destType, Intent intent) {
709709 {
710710 this .callbackContext .success (uriString );
711711 } else {
712- // If we don't have a valid image so quit.
713- if (!(JPEG_MIME_TYPE .equalsIgnoreCase (mimeType ) || PNG_MIME_TYPE .equalsIgnoreCase (mimeType ))) {
714- LOG .d (LOG_TAG , "I either have a null image path or bitmap" );
715- this .failPicture ("Unable to retrieve path to picture!" );
716- return ;
717- }
718712 Bitmap bitmap = null ;
719713 try {
720714 bitmap = getScaledAndRotatedBitmap (uriString );
0 commit comments