mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 15:18:01 +00:00
21 lines
831 B
Markdown
21 lines
831 B
Markdown
# 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](https://unsplash.com).
|
|
|
|

|
|
|
|
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](https://www.gatsbyjs.org/) docs use it to great effect in a
|
|
tutorial so as to not get caught up with the details of serving a specific
|
|
image.
|