Skip to content

Instantly share code, notes, and snippets.

@briangershon
Created December 20, 2023 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briangershon/fe7a2b0ba366a966e64e64ab98b40776 to your computer and use it in GitHub Desktop.
Save briangershon/fe7a2b0ba366a966e64e64ab98b40776 to your computer and use it in GitHub Desktop.
How to link directly to an unsplash.com image (via Unsplash API)
  1. Search for photo by viewing on unsplash.com and finding ID in URL. For example https://unsplash.com/photos/photo-of-green-leafed-plants-QKo-op_gR9I which has ID QKo-op_gR9I
  2. Grab your access key from Unsplash API dashboard: ACCESS_KEY_GOES_HERE
  3. Grab JSON file by plugging in ID and client_id into API so URL looks like this: https://api.unsplash.com/photos/QKo-op_gR9I?client_id=ACCESS_KEY_GOES_HERE
  4. Pull out the regular size URL from the JSON in "urls > regular" key (which is 1080 wide) and use that in the site
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment