I'm using Cloudinary images with the Ionic framework via the cloudinary-angular
library and I'm having some issues with the images loading.
When I test via the ionic serve
method, things seem to work fine. However, when I install the app to the device, the images break. Anyone have any ideas of how to fix this?
The following are examples of some of my code:
<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>
and:
$scope.backgroundImg = $.cloudinary.url($scope.bucket.mybucket + "/" + results.response[0].Attachment.name, { format: 'png', height: 800, width: 580, crop: 'fit' }).toString();
And like I said, both of these work using ionic serve
.
Update: Using Safari debug tool, I discovered the following.
Fixed One Issue: App Transport Security issue was fixed by adding the following to the app's Info.plist under Resources/MyApp-Info.plist
. More details at App Transport Security.
Fixed Second Issue: Ended up being an issue with the cloudinary_angular library. For some reason, it's returning the url with the file://
prototocol instead of the http://
one that the app needed. See the solution via my fork robksawyer/cloudinary_angular.