Filling holes in image IDs
pzich opened this issue · comments
While building some prototypes with an array of images, I found that some some IDs seem to return a 404 with Image does not exist
. As example, this code…
new Array(20).fill().forEach((_, i) => {
const img = new Image()
img.width = 100
img.height = 100
img.src = `https://picsum.photos/id/${i + 740}/100/100`
document.body.appendChild(img)
})
…results in this set of mostly broken images.
![740 - 759](https://private-user-images.githubusercontent.com/706138/309114514-1adffd21-80ed-4d50-a637-76ff26066552.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTM5MTg3NTQsIm5iZiI6MTcxMzkxODQ1NCwicGF0aCI6Ii83MDYxMzgvMzA5MTE0NTE0LTFhZGZmZDIxLTgwZWQtNGQ1MC1hNjM3LTc2ZmYyNjA2NjU1Mi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNDI0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDQyNFQwMDI3MzRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lYjgyZWFhNWQxZTc5NmMxN2VlMzQ3ZDQyNjQ4NDFjNTZjODVmMjhhYmQ4NGY3N2I2ZmFjMTZmNTNmODk1MWI0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.wKGr-xNPEgiB57zj3qDqX3hXQg41ChxDE9GT1dR28Lg)
To check which ones are missing/broken, I created this tester page and found that the following IDs resulted in errors:
86, 97, 105, 138, 148, 150, 205, 207, 224, 226, 245, 246, 262, 285, 286, 298, 303, 332, 333, 346, 359, 394, 414, 422, 438, 462, 463, 470, 489, 540, 561, 578, 587, 589, 592, 595, 597, 601, 624, 632, 636, 644, 647, 673, 697, 706, 707, 708, 709, 710, 711, 712, 713, 714, 720, 725, 734, 745, 746, 747, 748, 750, 749, 751, 753, 752, 754, 759, 761, 762, 763, 771, 792, 801, 812, 843, 850, 854, 895, 897, 899, 917, 920, 934, 956, 963, 968, 1007, 1017
I'm not quite sure what causes these images to error, but I was wondering if it'd be possible to either squash the list down so all of the IDs are sequential or (in case people are relying on specific IDs) replace them with other working images? It would simplify prototypes that need to show a range of images and eliminate needing special code to check if the images error out and need to use a different ID.
Hi,
Thank you for filing an issue! The IDs of existing images can't be changed for backwards compatibility reasons, and we currently have no plans to fill the gaps, you shouldn't be relying on them being sequential.
If you want a static set of images rather then random from just passing the dimensions, you can paginate use the list endpoint to get valid IDs, or use the /seed endpoint.