我正在为我的混合应用程序和使用Cordova的Ionic框架工作,我面临着在ios和android中使用相机拍摄的照片的问题 . 在纵向模式下使用设备相机拍摄照片时,其方向会自动更改 . 问题出在移动应用程序(ios和android)和web(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
这是我的第一个 stack overflow 问题,所以请原谅我的错误,先谢谢 .
1 回答
要在iOS上修复它:
correctOrientation: true
指令是关键 . 希望这有帮助!