title: Android Image Orientation issue
body: <p>I have a method to <strong>get photo orientation</strong> but when image is taken on portrait mode and after selected from gallery this method rotate to flip vertical.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>This method is now used to show images selected from gallery</p>
  
  <pre><code>public static Boolean ShowImagesCapture(Context context, Uri PATH_IMAGE, ImageView view,int width, int height){
  
      int orientation=0;
      Boolean success = true;
      try {
          Bitmap bitmap =null;
          BitmapFactory.Options options = new BitmapFactory.Options();
          options.inJustDecodeBounds = true;
  
          if (Build.VERSION.SDK_INT &lt; 19) {
              String selectedImagePath = getPath(PATH_IMAGE,context);
              bitmap = decodefilebitmap(selectedImagePath,bitmap.getWidth(),bitmap.getHeight());
              orientation=GetPhotoOrientation(context,getRealPathFromURI(context,PATH_IMAGE));
          }
  
          else {
              ParcelFileDescriptor parcelFileDescriptor;
  
              try {
                  parcelFileDescriptor = context.getContentResolver().openFileDescriptor(PATH_IMAGE, "r");
                  FileDescriptor fileDescriptor = parcelFileDescriptor.getFileDescriptor();
                  bitmap = BitmapFactory.decodeFileDescriptor(fileDescriptor);
                  parcelFileDescriptor.close();
                  orientation=GetPhotoOrientation(context,getRealPathFromURI(context,PATH_IMAGE));
  
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
          switch (orientation) {
  
  
              case ExifInterface.ORIENTATION_ROTATE_180:
                  bitmap=rotateBitmap(bitmap,3,width,height);
                  view.setImageBitmap(bitmap);
  
                  break;
  
              case ExifInterface.ORIENTATION_ROTATE_90:
                  bitmap=rotateBitmap(bitmap,8,width,height);
                  view.setImageBitmap(bitmap);
                  break;
  
              case ExifInterface.ORIENTATION_TRANSVERSE:
                  break;
  
              case ExifInterface.ORIENTATION_ROTATE_270:
                  bitmap=rotateBitmap(bitmap,6,width,height);
                  view.setImageBitmap(bitmap);
                  break;
  
              default:
                  view.setImageBitmap(bitmap);
  
          }
  
          bitmap = null;
  
      }
      catch (Exception e) {
          e.printStackTrace();
          success= false;
      }
      System.gc();
      return success;
  }
  </code></pre>