danielsogl / awesome-cordova-plugins

Native features for mobile apps built with Cordova/PhoneGap and open web technologies. Complete with TypeScript support.
https://danielsogl.gitbook.io/awesome-cordova-plugins/
Other
2.41k stars 2.42k forks source link

Can’t get gallery image with url #2318

Closed minareth closed 3 years ago

minareth commented 6 years ago

I'm submitting a ... (check one with "x") [ x ] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://ionicworldwide.herokuapp.com/

Current behavior:

Hello. I’m trying to prepare image for sending to the server from gallery or camera. Started with gallery. Using cordova-plugin-camera. I’m getting an image URL like content://media/external/images/media/27494/

when I use it in img src="{{URL}}"

I get broken-link icon , or grey background in case if ion-img

`<>

\ \ \ \ \
\ \
\ \ \
{{lastImage}}
\
"{{lastImage}}"
\

Please Select `Image!

<<.ts>> options: CameraOptions = { quality: 50, destinationType: 2, encodingType: this.camera.EncodingType.JPEG, mediaType: this.camera.MediaType.PICTURE, sourceType: 0, }; public presentActionSheet() { let actionSheet = this.actionSheetCtrl.create({ title: 'Select Image Source', buttons: [ { text: 'Load from Library', handler: () => { this.camera.getPicture(this.options).then((imageData) => { this.lastImage = this.sanitizer.bypassSecurityTrustUrl(imageData); this.lastImageNotSanitized = imageData; }, (err) => { this.presentToast('Error.'); }); } }, { text: 'Cancel', role: 'cancel' } ] }); actionSheet.present(); } `

Expected behavior:

<img style="width: 200px; height: 60px;" ngIf="lastImage" src="content://media/external/images/media/27494/"> <ion-img style="width: 200px; height: 60px;" ngIf="lastImage" src="content://media/external/images/media/27494/">

those should show images, not broken link icons

Steps to reproduce:

code is above, I'm using ionic view application on meizu 5, android 6.0

Related code: s80206-14200892

code is above

insert any relevant code here

Other information:

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

insert the output from ionic info here

cli packages: (C:\Users\User\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 6.3.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v8.4.0
    npm  : 5.3.0
    OS   : Windows 10

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro
danielsogl commented 6 years ago

Please format your issue code

sizvix commented 6 years ago

Same bug here, sometines, the module return a "content://" path and not a "file://"