【发布时间】:2016-07-09 05:37:33
【问题描述】:
我正在为我的混合应用程序开发 Ionic 框架并使用 Cordova,我遇到了在 ios 和 android 中使用相机拍摄的照片的问题。当使用设备相机以纵向模式拍摄照片时,它的方向会自动更改。问题存在于移动应用程序(ios 和 android)和网络(safari 和 chrome)中。我在应用程序中使用了cordova-plugin-camera,这是插件ios代码中UIImage+CropScaleOrientation.m文件中的代码,其中ios的旋转正在发生
(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
在选择(捕获)之后,它会在 chrome(android) 和 safari(iphone) 中更改其方向和 webview picture orientation getting chaned in web also
这是我的第一个堆栈溢出问题,请原谅我的错误,在此先感谢。
【问题讨论】:
标签: android ios cordova ionic-framework cordova-plugins