Fix Unsplash's random server down with alternative - picsum

pull/146/head
tin33392js 3 years ago
parent 236f68461b
commit 1bd63ee4ac

@ -1,10 +1,16 @@
const container = document.querySelector('.container')
const unsplashURL = 'https://source.unsplash.com/random/'
const picsumURL = 'https://picsum.photos'
const rows = 5
for(let i = 0; i < rows * 3; i++) {
const img = document.createElement('img')
img.src = `${unsplashURL}${getRandomSize()}`
/*
Unplash's random-server is down at the moment. Use 'picsum' instead
Picsum URL: https://picsum.photos/<width>/<height>/?<randomChar>
*/
// img.src = `${unsplashURL}${getRandomSize()}`;
img.src = `${picsumURL}/${getRandomNr()}/${getRandomNr()}/?${i}`;
container.appendChild(img)
}

Loading…
Cancel
Save