@hiralbarot wrote:
Hi Folks,
I have downloaded image using following code ,
this.storageDirectory = cordova.file.documentsDirectory; ( As i am targetting ios at the moment)
downloadImage(image) {
this.platform.ready().then(() => { const fileTransfer: TransferObject = this.transfer.create(); var url = encodeURI("https://i.pinimg.com/736x/16/a8/eb/16a8eb1a9dfab022ea92cb0d66b0a6c1--corgi-puppies-baby-corgi.jpg"); fileTransfer.download(url, this.storageDirectory + image).then((entry) => { const alertSuccess = this.alertCtrl.create({ title: `Download Succeeded!`, subTitle: `${image} was successfully downloaded to: ${entry.toInternalURL()}`, buttons: ['Ok'] }); this.isImage = true; this.internalSrc = entry.toURL(); alertSuccess.present(); }, (error) => { const alertFailure = this.alertCtrl.create({ title: `Download Failed!`, subTitle: `${image} was not successfully downloaded. Error code: ${error.code}`, buttons: ['Ok'] }); alertFailure.present(); }); });}
i am getting success alert but i am not able to display this downloaded image in iphone .
This is my html code ,<img *ngIf="isImage" [src]="internalSrc" alt="pug"/>Am i missing anything ?
Any help would be appreciated.
Thanks!
Posts: 1
Participants: 1