|
@@ -1877,8 +1877,20 @@
|
|
|
var thumbData = JSON.parse(event.data);
|
|
|
$(".fileObject").each(function(){
|
|
|
if (thumbData[1].length > 0){
|
|
|
+ //Extract image type from base64
|
|
|
+ let tid = thumbData[1].charAt(0);
|
|
|
+ let ext = "jpg";
|
|
|
+ if (tid == "i"){
|
|
|
+ ext = "png";
|
|
|
+ }else if (tid == "R"){
|
|
|
+ ext = "gif";
|
|
|
+ }else if (tid == "U"){
|
|
|
+ ext = "webp";
|
|
|
+ }
|
|
|
+
|
|
|
+ //Put the image data to image element
|
|
|
if ($(this).attr("filename") == thumbData[0]){
|
|
|
- $(this).find("img").attr("src","data:image/jpg;base64," + thumbData[1]);
|
|
|
+ $(this).find("img").attr("src","data:image/" + ext + ";base64," + thumbData[1]);
|
|
|
}
|
|
|
}
|
|
|
|