-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathimages.js
37 lines (28 loc) · 1.22 KB
/
images.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function getImages() {
const params = new Proxy(new URLSearchParams(window.location.search), {
get: (searchParams, prop) => searchParams.get(prop),
});
const tags = params.stock;
fetch(`https://filmboi.fly.dev/?tags=${tags}`)
.then((response) => response.json())
.then((images) => {
const flexBox = document.getElementById("box");
images.forEach(image => {
let div = document.createElement('div');
div.className = "item-zoom-subtle";
let imageElement = document.createElement('img');
let url = image.url.replace("upload/", "upload/w_500,h_300,c_fill/");
imageElement.src = url;
imageElement.loading = "lazy";
let linkElement = document.createElement('a');
linkElement.href = image.url;
linkElement.appendChild(imageElement)
div.appendChild(linkElement);
flexBox.appendChild(div);
});
});
}
getImages();
{/* <div class="item-zoom-subtle">
<img src="http://res.cloudinary.com/dacv415jh/image/upload/w_250,h_150,c_fill/v1674262821/Film/PenEE/Fujic200-penee-19082022/R1-09151-007A_zwplwn.jpg" alt="">
</div> */}