【发布时间】:2015-12-17 14:41:23
【问题描述】:
我正在通过 cloudinary-angular 库将 Cloudinary 图像与 Ionic 框架一起使用,但我在加载图像时遇到了一些问题。
当我通过ionic serve 方法进行测试时,似乎一切正常。但是,当我将应用程序安装到设备时,图像会中断。有人知道如何解决这个问题吗?
以下是我的部分代码示例:
<cl-image ng-if="item.Attachment.name" public-id="{{bucket.mybucket}}/{{item.Attachment.name}}" crop="thumb" width="100" height="100" radius="max" format="png"></cl-image>
<cl-image ng-if="!item.Attachment.name" public-id="{{bucket.mybucket}}/{{bucket.defaultCheese}}" crop="thumb" width="100" height="100" radius="max" format="png"></cl-image>
和:
$scope.backgroundImg = $.cloudinary.url($scope.bucket.mybucket + "/" + results.response[0].Attachment.name, { format: 'png', height: 800, width: 580, crop: 'fit' }).toString();
就像我说的,这两个都使用ionic serve。
修复了一个问题:通过将以下内容添加到应用程序的 Info.plist 中 Resources/MyApp-Info.plist 下,修复了应用程序传输安全问题。更多详情请访问App Transport Security。
修复了第二个问题:最终成为cloudinary_angular 库的问题。出于某种原因,它返回带有file:// 协议的url,而不是应用程序需要的http://。通过我的 fork robksawyer/cloudinary_angular 查看解决方案。
【问题讨论】:
标签: ios angularjs ionic cloudinary