Unsplash Source for aesthetic placeholder images

4 min read

When developing the design of website pages with photographs from the user, I use random images from the Unsplash service. They have an official, but deprecated service, which was replaced by a fresh API. However, I continue to use the old service — and here's why.

Unsplash Source does not require registration. You can use a link to the image without any keys in any place where you could indicate it. It also has a clear photo request interface, which I’ll talk about below.

For example, here is a landscape image.

https://source.unsplash.com/random/?landscape

And a campfire photo.

https://source.unsplash.com/random/?campfire

Both pictures above were chosen randomly by the Unsplash servers.

Reload the page and you will see that the pictures have changed, but remain relevant to the theme.

What does deprecated mean

The service is considered obsolete and continues to operate. This is what it says on the official website.

I couldn’t find any official documentation for it, but I did find a detailed answer on Reddit from a representative of the Unsplash team. I will describe this already structured answer in the article.

The only limitation that currently exists for Unsplash Source is that the reply uses photos that were published before the service became obsolete.

Getting images

Requesting a random image.

https://source.unsplash.com/random

Image from the all featured list.

https://source.unsplash.com/featured

Or from specific user.

https://source.unsplash.com/user/{USERNAME}/ https://source.unsplash.com/user/scottwebb https://source.unsplash.com/user/scottwebb/featured https://source.unsplash.com/user/scottwebb/likes

Custom size

Additionally, you can specify the final image size. To do this, indicate resolution at the end of the address.

https://source.unsplash.com/random/1600x900 https://source.unsplash.com/all/1600x900 https://source.unsplash.com/user/scottwebb/1600x900

Search terms

You can narrow the selection of random images to specific topics by specifying keywords separated by a comma after the question mark in the address. Isn't that cool?

https://source.unsplash.com/random?apple,desk https://source.unsplash.com/1600x900?apple,desk https://source.unsplash.com/featured/1600x900?apple,desk

Daily or weekly update

All of the above queries return a new image every time, provided that there is a large range of photos to choose from due to filters. But there are keys for limiting the frequency of changing photos on request: /daily and /weekly.

Add them at the end of the address to clarify how often this image by your criteria is changed.

https://source.unsplash.com/daily https://source.unsplash.com/user/scottwebb/featured/1600x900/daily https://source.unsplash.com/1600x900/weekly?apple,desk

Multiple images with the same address problem

I encountered a problem with displaying several images on a page at the same address - they appeared the same.

https://source.unsplash.com/random https://source.unsplash.com/random https://source.unsplash.com/random

But if you add the addresses ?1, ?2, and so on at the end of the line, the server will perceive these as different addresses and return different pictures.

https://source.unsplash.com/random?1 https://source.unsplash.com/random?2 https://source.unsplash.com/random?3