I have the same problem and I’m not using Ionic. Probably angularjs doesn’t like the cdvfile protocol.
At the moment i’m setting the src in the old way: document.getElementById(‘myImageId’).src= 'cdvfile://localhost/[something]/1395167011485.jpg’
If anyone find a better solution that would be appreciated.
Basically, you need to install the org.apache.cordova.file-system-roots plugin and that will enable you to resolve the paths that the camera plugin returns to a physical file on the filesystem. However, you will still need to do a bit of work to get the image path returned from picking an item from the gallery since the URL that the camera plugin returns in that case has a cache-busting timestamp attached to it as a query string. Alternatively, you may have to remove any kind of post-processing in order to escape having the picture go to a temp location.
Settings such as targetWidth, targetHeight, and, most recently, correctOrientation will all call for some kind of post processing and thus the need to use a temp filesystem.
Hi I had similar a problem with cordova and getting the image from the album… The image was represent with blob: prefix similar like your case with file: or cvfile, when I was puting the blob data with angular {{img}} notation I also get the broken link the reason is that angular is putting unsafe: prefix before link… If this is your case try to put in config of the main module …
Pls Help me, i am getting error as “content://com.android.providers.media.documents/document/image%3A5047” this error in alert msg in android mobile. may i know how to fix this???
Mine still comes as broken even when i use the cdvfile location i even tried whilelisting the cdvfile No use, tried converting the file obtained from path to base 64 still no use -_-
well, i used the cdv file to upload it to a server path with the user-id and then got the image back from the server to display . Literally, had to go the long way, since i couldn’t quite find the right solution at the right time.
I know this is an older post but as a heads up if you are using live reload you will get errors trying to use file:// or cdv:// paths. I rebuilt the app w/o live reload and everything worked without issue using either of those path types. Hope this helps somebody down the road!
@niczak thank you so much. This was driving me nuts. Important to note here that not only will this not work if live reload is running, but I had to remove any of the <allow-navigation> tags that live reload puts in your config.xml. I removed all <allow-navigation> tags from config.xml except for:
I have recently faced same issue. Appears that cordova ios app is run on localhost:8080 internally, this is main reason why it doesn`t allow to load files from “file://” protocol.