{"id":13878317,"url":"https://github.com/railsjazz/unsplash_image","last_synced_at":"2025-07-10T22:04:58.444Z","repository":{"id":37559265,"uuid":"500991026","full_name":"railsjazz/unsplash_image","owner":"railsjazz","description":"Unsplash random image generator and downloader","archived":false,"fork":false,"pushed_at":"2025-05-12T20:56:52.000Z","size":71,"stargazers_count":38,"open_issues_count":11,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-23T02:04:32.969Z","etag":null,"topics":["rails","ruby","unsplash"],"latest_commit_sha":null,"homepage":"https://railsjazz.com/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/railsjazz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"patreon":"igorkasyanchuk"}},"created_at":"2022-06-07T20:16:50.000Z","updated_at":"2025-06-05T01:18:35.000Z","dependencies_parsed_at":"2024-09-25T03:26:24.754Z","dependency_job_id":"36e2c8e0-79b4-462c-96a2-ed4c318fbb40","html_url":"https://github.com/railsjazz/unsplash_image","commit_stats":{"total_commits":23,"total_committers":4,"mean_commits":5.75,"dds":0.5652173913043479,"last_synced_commit":"db692199d0554a3d2c1264218c353d5209c305a3"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/railsjazz/unsplash_image","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsjazz%2Funsplash_image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsjazz%2Funsplash_image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsjazz%2Funsplash_image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsjazz%2Funsplash_image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/railsjazz","download_url":"https://codeload.github.com/railsjazz/unsplash_image/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsjazz%2Funsplash_image/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264673578,"owners_count":23647647,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rails","ruby","unsplash"],"created_at":"2024-08-06T08:01:46.175Z","updated_at":"2025-07-10T22:04:58.439Z","avatar_url":"https://github.com/railsjazz.png","language":"Ruby","funding_links":["https://patreon.com/igorkasyanchuk","https://buymeacoffee.com/igorkasyanchuk"],"categories":["Ruby"],"sub_categories":[],"readme":"# Unsplash Image Downloader \u0026 Helpers\n\n[![RailsJazz](https://github.com/igorkasyanchuk/rails_time_travel/blob/main/docs/my_other.svg?raw=true)](https://www.railsjazz.com)\n\n[![\"Buy Me A Coffee\"](https://github.com/igorkasyanchuk/get-smart/blob/main/docs/snapshot-bmc-button-small.png?raw=true)](https://buymeacoffee.com/igorkasyanchuk)\n\nA CLI and a set of Rails helpers to get free images from [Unsplash](https://unsplash.com/).\n\nThis is the easiest way to fill your Rails app with real photos.\n\n## Usage\n\n1. as Rails helper to generate dummy images:\n```ruby\n\u003c%= image_tag unsplash_image_url(size: '300x200', tags: 'cat, dog') %\u003e\n\n\u003c%= image_tag unsplash_image_url(size: '800x600', tags: 'building') %\u003e\n\n\u003c%= image_tag unsplash_image_url(tags: 'nature') %\u003e\n```\n\n2. as a tool to download images from Unsplash.com and use them for your seeds or specs.\n\n```bash\nunsplash_image download --path images/cats --tags cat -n 20\n```\n\n3. If you need to have a `File` object with a random image.\n\n```ruby\nfile = UnsplashImage.tempfile(size: '500x500', tags: 'cat')\n```\n\n### CLI\n\nBy default `unsplash_image download  --path ./files` will download 10 random images into a `./files` folder.\n\nYou can see list of all available options by running:\n\n\n```bash\nunsplash_image --help download\n```\n\nWith additional options you can specify a destination folder, tags, resolution of the images.\n\n\n### In your Rails app\n\nYou can get random image url inside your views using `unsplash_image_url`.\n\nExample:\n```erb\n\u003c%= image_tag unsplash_image_url(size: '300x200', tags: 'cat, dog') %\u003e\n```\n\nAlso you can get it as a file with `UnsplashImage.tempfile`.\n\nExample:\n```ruby\nfile = UnsplashImage.tempfile(size: '500x500', tags: 'cat')\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"unsplash_image\"\n```\n\nAnd then execute:\n```bash\n$ bundle\n```\n\nTo use CLI anywhere in the system you can install gem globally:\n\n```bash\ngem install unsplash_image\n```\n\n## Unit Tests\n\nWe have simple tests, just run: `ruby test/unsplash_image_test.rb`.\n\n## Contributing\n\nYou are welcome to contribute. See list of `TODO's` below.\n\n## TODO\n\n- allow caching downloaded files for performance improvement (eg using in factories)\n- check with older Rails versions\n- tests or specs\n- make stand-alone executable installable via `brew`, `apt get`, etc?\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n[\u003cimg src=\"https://github.com/igorkasyanchuk/rails_time_travel/blob/main/docs/more_gems.png?raw=true\"\n/\u003e](https://www.railsjazz.com/?utm_source=github\u0026utm_medium=bottom\u0026utm_campaign=unsplash_image)\n\n[![\"Buy Me A Coffee\"](https://github.com/igorkasyanchuk/get-smart/blob/main/docs/snapshot-bmc-button.png?raw=true)](https://buymeacoffee.com/igorkasyanchuk)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frailsjazz%2Funsplash_image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frailsjazz%2Funsplash_image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frailsjazz%2Funsplash_image/lists"}