fix thumbnails for direct loaded dicoms

This commit is contained in:
Ross
2021-06-26 14:31:52 +01:00
parent 8886192a18
commit 8e17e96226
+4 -4
View File
@@ -963,7 +963,8 @@ async function loadQuestion(n, section = 1, force_reload = false) {
$("#figure-" + id).append(img); $("#figure-" + id).append(img);
// otherwise try to load it as a dicom (if it starts with data) // otherwise try to load it as a dicom (if it starts with data)
} else if (based_img.startsWith("data:")) { // or ends with dcm
} else if (based_img.startsWith("data:") || based_img.endsWith(".dcm") || /(?:\/|^)[^.\/]+$/.test(based_img)) {
// convert the data url to a file // convert the data url to a file
viewer viewer
.urltoFile(based_img, "dicom", "application/dicom") .urltoFile(based_img, "dicom", "application/dicom")
@@ -975,9 +976,8 @@ async function loadQuestion(n, section = 1, force_reload = false) {
const img = $("<div></div>").get(0); const img = $("<div></div>").get(0);
img.id = "thumb-" + id; img.id = "thumb-" + id;
img.class = "thumbnail"; img.class = "thumbnail";
img.title = img.title = "Click on the thumbnail to view and manipulate the image.";
//"Click on the thumbnail to view and manipulate the image."; img.draggable = "false";
img.draggable = "false";
img.style = "height: 100px; width: 100px"; img.style = "height: 100px; width: 100px";
$("#figure-" + id).append(img); $("#figure-" + id).append(img);
const element = document.getElementById("thumb-" + id); const element = document.getElementById("thumb-" + id);