Skip to content
Snippets Groups Projects
Commit 0719e982 authored by Haakon Gunleiksrud's avatar Haakon Gunleiksrud
Browse files

Merge branch 'feat/display_workout_image' into 'master'

feat/add preview of image in workout if image file

See merge request aasmuha/tdt4242-base!16
parents d65fa134 c5bfcacb
Loading
......@@ -41,7 +41,19 @@ async function retrieveWorkout(id) {
let pathArray = file.file.split("/");
a.text = pathArray[pathArray.length - 1];
a.className = "me-2";
let img
let isImage = ["jpg", "png", "gif", "jpeg", "JPG", "PNG", "GIF", "JPEG"].includes(a.text.split(".")[1]);
if(isImage){
img = document.createElement("img");
img.src = file.file;
img.width = "500";
}
filesDiv.appendChild(a);
if(isImage){
filesDiv.appendChild(img);
}
}
// create exercises
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment