jpg, jpeg is not displaying
Opened this issue · 3 comments
i m using ngx-imageviewer for displaying preview of images which I'm uploading using
< input type= "file" >
. But i can see only images with type png. Images with type jpg and jpeg is not getting displayed.
This is code below
< output id= "list" class= "float-left" >
< div class= "float-left" >
<span *ngFor="let thumbnail of thumbnailPreviewList;let idx = index;">
<ngx-imageviewer [src]= " thumbnail" class="float-left" (click)="displaySelectedDocumentForPreview(thumbnail)"></ngx-imageviewer>
< /span>
< /div>
< /output>
But imageviewer is working fine in other ui screen of same project
I have the same issue.
I'm retrieving the images via api call then parsing the response blob to a base64 string which then gets sent to ngx-imageviewer. This works fine for pngs and pdfs but jpegs don't display.
Any solution? have the same issue, the image is loaded from api @clewarne @rahulkumarshaw1
Working with v1.2.2 (current projet on angular 5.2.9).
Maybe problem came from here:
private isImage(file: string | File) {
if (this._filetype && this._filetype.toLowerCase() === 'image') { return true; }
return testFile(file, '\\.(png|jpg|jpeg|gif)|image/png');
}
Should be:
return testFile(file, '\\.(png|jpg|jpeg|gif)|image/png|image/jpg|image/jpeg');
Possible workaround in your app:
if (type === 'image/jpeg') {
blob = new Blob([data], { type: '.jpeg' });
}
else if (type === 'image/jpg') {
blob = new Blob([data], { type: '.jpg' });
}
else {
blob = new Blob([data], { type: type });
}