2016-03-22 22 views
2

ハイブリッドアプリのIonicフレームワークとCordovaを使用しています。イオスとアンドロイドの両方で。ポートレートモードのデバイスカメラを使用して写真を撮影すると、向きが自動的に変更されます。モバイルアプリ(iOS &アンドロイド)とウェブ(safari &クロム)の両方に問題があります。私は、アプリケーション内のコルドバ・プラグインカメラを使用し、これは、iOS用の回転が行わイオンフレームワークとコードバ - プラグイン - カメラで撮影したカメラの画像が時計回りに反時計回りに90度回転しています

(UIImage*)imageCorrectedForCaptureOrientation:(UIImageOrientation)imageOrientation 
    { 
     float rotation_radians = 0; 
     bool perpendicular = false; 

     switch (imageOrientation) { 
      case UIImageOrientationUp : 
       rotation_radians = 0.0; 
       break; 

      case UIImageOrientationDown: 
       rotation_radians = M_PI; // don't be scared of radians, if you're reading this, you're good at math 
       break; 

      case UIImageOrientationRight: 
       rotation_radians = M_PI_2; 
       perpendicular = true; 
       break; 

      case UIImageOrientationLeft: 
       rotation_radians = -M_PI_2; 
       perpendicular = true; 
       break; 

      default: 
       break; 
     } 
    } 

this is how i captured the image with device camera

を取っているプラ​​グインのIOSコードでUIImage + CropScaleOrientation.mファイル内のコードで、(キャプチャ選択した後)、それは)iphone(およびWebViewの中でも、クロム(アンドロイド)でとSafariの両方にその向きを変える picture orientation getting chaned in web also

これはそう、事前に感謝し、私の過ちを許し、私の最初のスタックオーバーフロー質問です。 iOSの修正、それについては

答えて

3

navigator.camera.getPicture(onSuccess, onFail, { 
     quality: 75, 
     destinationType: Camera.DestinationType.DATA_URL, 
     correctOrientation: true, 
     saveToPhotoAlbum: true 
    }); 

correctOrientation: true命令がキーです。 願っています!

+1

また、Androidでも動作します。参考:[GitHubページ](https://github.com/apache/cordova-plugin-camera#cameracameraoptions--object) 'correctOrientation'を参照してください。 –

関連する問題