pietos commented on issue #512:
URL:
https://github.com/apache/cordova-plugin-file/issues/512#issuecomment-1048483440
I had a similar issue as a workaround I load the files into a blob and then
attach the blob to the html view.
First I only had to do this for IOS devices, but since the latest cordova
and android updates I use the IOS condition for both Android and IOS.
**Example code**
// remark: rs.rows.item(0).localsrc; the store result of
fileEntry.toInternalURL();
rs.rows.item(0).localsrc; (which is fileEntry.toInternalURL();)
// On IOS we have to convert the image to a blob
window.resolveLocalFileSystemURL(rs.rows.item(0).localsrc,
function(fileEntry) {
if (window.cordova.platformId == "ios") {
fileEntry.file(function(file) {
var reader = new FileReader();
reader.onloadend = function() {
if (reader.result) {
var blob = new Blob([new Uint8Array(reader.result)], { type:
"image/jpeg" });
blob = window.URL.createObjectURL(blob);
companylogoimgEL.src = blob;
} else {
companylogoimgEL.src = 'res/' + APP_SELLER +
'/logo_horizontal_white_smaller.png';
}
};
reader.readAsArrayBuffer(file);
});
// On Android we can just load the local file
} else {
companylogoimgEL.src = rs.rows.item(0).localsrc;
}
}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]