You've already forked collage-maker
Show images from urls
This commit is contained in:
10
web/index.js
10
web/index.js
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user