Show images from urls

This commit is contained in:
2024-08-08 12:05:40 -04:00
parent e21cc83a5f
commit 1bf6bf9033
3 changed files with 34 additions and 1 deletions

View File

@@ -51,7 +51,7 @@ let collageUrlA
let crops = [];
let pageSize = "letter-landscape";
const imageUrls = [
let imageUrls = [
, // images start with index 1
"images/img1.jpg",
"images/img2.jpg",
@@ -75,6 +75,8 @@ function main() {
for(const tmpl of document.getElementsByClassName("template")) {
tmpl.onclick = () => applyTemplate(tmpl)
}
const queryUrls = loadImageUrlsFromQuery()
imageUrls = [,].concat(queryUrls)
applyTemplate(document.getElementById("default_template"))
}
@@ -210,4 +212,10 @@ function applyTemplate(templateDiv) {
initCollage()
}
function loadImageUrlsFromQuery() {
const params = new URLSearchParams(window.location.search)
const urlsstr = params.get('urls')
return JSON.parse(urlsstr)
}
main()