【问题标题】:Cordova returns photo in landscape with black region top and bottomCordova 以黑色区域顶部和底部返回横向照片
【发布时间】:2016-05-10 16:51:45
【问题描述】:

有没有办法将Cordova camera plugin 配置为返回没有超出目标高度的黑带的照片?

例如,

这样设置选项时返回:

var options = {
        quality: 100,
        destinationType: Camera.DestinationType.FILE_URI,
        sourceType: Camera.PictureSourceType.CAMERA,
        allowEdit: true,
        encodingType: Camera.EncodingType.JPEG,
        targetWidth: 800,
        targetHeight: 1200,
        popoverOptions: CameraPopoverOptions,
        saveToPhotoAlbum: false,
        correctOrientation: true
      };
$cordovaCamera.getPicture(options).then(function (imageURI) {});

我已尝试删除 targetWidthtargHeight 参数。您无法提前知道照片是横向还是纵向的一个问题。

这是一个一年前从未回答过的问题:Phonegap Camera returns photo with black bars

【问题讨论】:

  • 它发生在 iOS 中吗?据我分析,在 iOS 中,很多人都遇到过类似的问题,因为没有设置启动屏幕。看看这个链接 - stackoverflow.com/questions/32641240/…
  • 与该链接的主题无关,抱歉。
  • 您能在此处或在 gtihub 中发布您的完整代码,以便我们模拟问题吗?
  • @metalaureate 检查您的移动设备相机选项,您必须为这种类型的视图选择一些东西。调用相机后,转到设备中的每个选项

标签: android ios cordova ionic-framework cordova-plugins


【解决方案1】:

不要使用allowEdit 选项或将其设置为false

当您使用allowEdit: true, 时,它会将您带到一个裁剪屏幕,该屏幕将创建一个方形图像,如果您不缩放图像来裁剪它,它将在顶部和底部添加黑色区域以使图像成为正方形

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-08
    • 1970-01-01
    • 1970-01-01
    • 2012-09-12
    • 1970-01-01
    • 2013-10-24
    相关资源
    最近更新 更多