Display image uri returned from cordova-plugin-camera in an IMG tag with cordova ios 6.0.0

401 views
Skip to first unread message

Veronica Bendersky

unread,
Jun 12, 2020, 2:34:17 PM6/12/20
to phonegap
Hi,

I'm porting an app to use WkWebView. Since cordova-ios 6.0.0 was released I decided to go with it directly, insteado of version 5.1.1 and the wkwebview engine plugin.

I am facing this issue which I cannot find a way to resolve.

The cordova-plugin-camera returns an URI that begins with file:// and it triggers an error when I try to display it in an IMG tag. 

I configured the WkURLSchemeHandler, added the preference settings to the config.xml, and I can access files inside the package www using it.

But how do I use it to show the photo the user selected from gallery? Or what do I need to use? 

From what I see, the photo URI returned ends with /tmp/photo.jpg. Looks like it is in the app's tmp folder. 

Thanks for any help, it has been hours trying to get this resolved.

jcesarmobile

unread,
Jun 13, 2020, 2:45:41 PM6/13/20
to phonegap
There is a helper function that converts file urls to the scheme you use

window.WkWebView.convertFilePath()

Reply all
Reply to author
Forward
0 new messages