public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode == Activity.RESULT_OK) {
     if (requestCode == 13) {
       PhotoViewer.getInstance().setParentActivity(parentFragment.getParentActivity());
       int orientation = 0;
       try {
         ExifInterface ei = new ExifInterface(currentPicturePath);
         int exif =
             ei.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
         switch (exif) {
           case ExifInterface.ORIENTATION_ROTATE_90:
             orientation = 90;
             break;
           case ExifInterface.ORIENTATION_ROTATE_180:
             orientation = 180;
             break;
           case ExifInterface.ORIENTATION_ROTATE_270:
             orientation = 270;
             break;
         }
       } catch (Exception e) {
         FileLog.e("tmessages", e);
       }
       final ArrayList<Object> arrayList = new ArrayList<>();
       arrayList.add(
           new MediaController.PhotoEntry(0, 0, 0, currentPicturePath, orientation, false));
       PhotoViewer.getInstance()
           .openPhotoForSelect(
               arrayList,
               0,
               1,
               new PhotoViewer.EmptyPhotoViewerProvider() {
                 @Override
                 public void sendButtonPressed(int index) {
                   String path = null;
                   MediaController.PhotoEntry photoEntry =
                       (MediaController.PhotoEntry) arrayList.get(0);
                   if (photoEntry.imagePath != null) {
                     path = photoEntry.imagePath;
                   } else if (photoEntry.path != null) {
                     path = photoEntry.path;
                   }
                   Bitmap bitmap = ImageLoader.loadBitmap(path, null, 800, 800, true);
                   processBitmap(bitmap);
                 }
               },
               null);
       AndroidUtilities.addMediaToGallery(currentPicturePath);
       currentPicturePath = null;
     } else if (requestCode == 14) {
       if (data == null || data.getData() == null) {
         return;
       }
       startCrop(null, data.getData());
     }
   }
 }