ngCordova: image as fileuri not displaying in image with ng-src

Using the camera plugin with the destinationType: Camera.DestinationType.FILE_URI I am unable to display the image in the iOS emulator. I have the image tag set to where imageUri when displayed as text or written to the console shows a url to the image file as file:///Users/mg/Library/Developer/CoreSimulator/Devices/08DEADD1-F5F6-4114-962B-5053C42F9912/data/Containers/Data/Application/46FF51F3-B356-4D4E-9F0A-9033607929DE/tmp/cdv_photo_003.jpg.

If I navigate to that url I can see the photo I selected on my computer’s filesystem. Additionally, if I upload the image to s3 it correctly uploads with the image as I’d expect. I’ve set compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel):/); in my apps config as well.

Any ideas what might be going on? I’d like to be able to display a preview of the image before uploading and I’d prefer to use the file_uri instead of base64 string for memory reasons and the image will be uploaded to s3.

Hi, I had the same problem as you, and I just solved it thank to this thread:

@xiaolong97427 I’ve tried the approaches in the post you linked but none works. Are you sure you didn’t do anything else to get the image to display on iOS? Thanks.