Skip to content

Instantly share code, notes, and snippets.

@rsp
Last active May 28, 2018 23:36
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rsp/5ca9e1ab25770faeaec1 to your computer and use it in GitHub Desktop.
Save rsp/5ca9e1ab25770faeaec1 to your computer and use it in GitHub Desktop.
Local lorempixel

How to quickly download Lorempixel images.

You can directly use URLs like this: http://lorempixel.com/400/300/nature/1/ but they will be downloaded every time from the Lorempixum server (they are not cached). For better performance or cache control you may want to save them locally. You can use cURL with its little known syntax for its input and -o arguments to do it easily.

Save filenames like nature-400x300-5.jpg:

curl 'http://{lorempixel}.com/{400}/{300}/{nature}/[1-10]/' -o '#4-#2x#3-#5.jpg'

Save filenames like lorempixel-nature-400x300-5.jpg:

curl 'http://{lorempixel}.com/{400}/{300}/{nature}/[1-10]/' -o '#1-#4-#2x#3-#5.jpg'

Save filenames with original order of variables like lorempixel-400x300-nature-5.jpg:

curl 'http://{lorempixel}.com/{400}/{300}/{nature}/[1-10]/' -o '#1-#2x#3-#4-#5.jpg'

Save filenames with only dashes like lorempixel-400-300-nature-5.jpg:

curl 'http://{lorempixel}.com/{400}/{300}/{nature}/[1-10]/' -o '#1-#2-#3-#4-#5.jpg'

Save filenames with only resolution and number like 400x300-5.jpg:

curl 'http://{lorempixel}.com/{400}/{300}/{nature}/[1-10]/' -o '#2x#3-#5.jpg'

Save filenames with just numbers like 5.jpg:

curl 'http://{lorempixel}.com/{400}/{300}/{nature}/[1-10]/' -o '#5.jpg'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment