Public
Edited
Oct 15, 2022
Importers
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function getRandomImageUrl(options) {
return getImageUrl(null, { random: randomId(), ...options });
}
Insert cell
getRandomImageUrl()
Insert cell
getImageUrl = (
id,
{ width = 400 * dpr, height = 300 * dpr, ...restParams } = {}
) => {
let url = "https://picsum.photos/";
if (id) {
url += `id/${id}/`;
}
url += `${width}/${height}/`;

return addParams(url, {
...restParams
});
}
Insert cell
getImageUrl(237)
Insert cell
randomId = () => (Math.random() * 10_000_00).toFixed(0)
Insert cell
dpr = window.devicePixelRatio
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more