Lucii1 commited on
Commit
7fac27a
·
1 Parent(s): bf6c7b3

update fn preview image

Browse files
Files changed (1) hide show
  1. main.js +9 -3
main.js CHANGED
@@ -879,11 +879,17 @@ window.goToEvidence = function () {
879
  };
880
 
881
  window.previewImage = function (imageRaw) {
882
- const match = (imageRaw.match(/\d+/) || 1) - 1;
883
- const image = data.value.readme_content.media[+match];
 
 
 
 
 
 
884
  createTemplateModal(
885
  `<img src="data:image/jpeg;base64,${image}" alt="Image Preview" style="max-width: 100%; height: auto;" />`,
886
- `Image ${+match + 1}`
887
  );
888
  };
889
 
 
879
  };
880
 
881
  window.previewImage = function (imageRaw) {
882
+ const match = imageRaw.match(/\d+/);
883
+ if (!match) return;
884
+
885
+ const index = Number(match[0]) - 1;
886
+ const image = data.value.readme_content.media[index];
887
+
888
+ if (!image) return;
889
+
890
  createTemplateModal(
891
  `<img src="data:image/jpeg;base64,${image}" alt="Image Preview" style="max-width: 100%; height: auto;" />`,
892
+ `Image ${index + 1}`
893
  );
894
  };
895