Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 831 Bytes

get-random-images-from-unsplash.md

File metadata and controls

20 lines (15 loc) · 831 Bytes

Get Random Images From Unsplash

The below doesn't work on GitHub. It seems that GitHub caches and serves its own version of the image. This will work anywhere where you aren't caching images.

Here is an image from unsplash.com.

random images

I don't know what image I am showing you though. That's because the URL being sourced for the above image is http://source.unsplash.com/random/1200x600. This tells unsplash to randomly serve us a 1200x600 image. Try refreshing the page and you'll see that it is different each time. Cool!

This is a bit of a novelty, but could be useful on occasion. The Gatsby docs use it to great effect in a tutorial so as to not get caught up with the details of serving a specific image.