Skip to content

Commit

Permalink
Merge pull request #209 from Lypsilonx/master
Browse files Browse the repository at this point in the history
Fix images not found?
  • Loading branch information
Berny23 authored Aug 6, 2024
2 parents 4cf840e + 0001bd8 commit 5daa7da
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions server/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ <h1>The Toy Pad</h1>

var content = "<h3>" + itemData.name + "</h3>";
var path = "images/" + itemData.id + ".png";
var url = $(location).attr("origin") + "/server/" + path;
var url = $(location).attr("href") + "/../" + path;
if (fileExists(url)) {
content = "<img src=" + path + " alt=" + itemData.name + " style='width: 100%; height: 100%; object-fit: contain; pointer-events: none;'>";
}
Expand All @@ -746,7 +746,6 @@ <h1>The Toy Pad</h1>
}

function fileExists(url) {
console.log(url);
var http = new XMLHttpRequest();
http.open('HEAD', url, false);
http.send();
Expand Down

0 comments on commit 5daa7da

Please sign in to comment.