Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

How to display an image captured with media capture

$
0
0

@ysrikanth2017 wrote:

Hello Everyone,

I am using Ionic 4 and Cordova Media Capture plugin to capture photos for Android .

(https://ionicframework.com/docs/native/media-capture)

As soon as I use the basic Image capture method

this.mediaCapture.captureImage(options) .then(
(data: MediaFile) => {

I am receiving this data for media file :-
[{“name”:“1585411855340.jpg”,“localURL”:“cdvfile://localhost/sdcard/Pictures/1585411855340.jpg”,“type”:“image/jpeg”,“lastModified”:null,“lastModifiedDate”:1585411864000,“size”:889041,“start”:0,“end”:0,“fullPath”:“file:///storage/emulated/0/Pictures/1585411855340.jpg”}]

But don’t know how can I display this image in the device directly right after capture.
I have tried using the base64 plugin to convert it to base 64 format and tried displaying.
It doesn’t work. It gives me a Not “NOT_FOUND_ERR”.

I later tried to use webview and it’s method :-
const img = this.webview.convertFileSrc(filePath)
The path I get is :
http://localhost/app_file/storage/emulated/0/Pictures/1585411855340.jpg",

But this time I get this error :-
E/WebViewAssetServer: Unable to open asset URL: http://localhost/app_file/storage/emulated/0/Pictures/1585411855340.jpg

I have tried this solution to enable permissions also but not worked .

If anyone has achieved this . Please let me know.

Thanks in Advance.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>