{"id":19898979,"url":"https://github.com/arkency/image_placeholder","last_synced_at":"2026-03-14T14:35:06.598Z","repository":{"id":56877391,"uuid":"156889405","full_name":"arkency/image_placeholder","owner":"arkency","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-11T16:17:42.000Z","size":47,"stargazers_count":58,"open_issues_count":6,"forks_count":7,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-04-30T02:22:05.740Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/arkency.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-09T16:33:52.000Z","updated_at":"2024-04-30T02:22:05.741Z","dependencies_parsed_at":"2022-08-20T23:10:32.723Z","dependency_job_id":null,"html_url":"https://github.com/arkency/image_placeholder","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkency%2Fimage_placeholder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkency%2Fimage_placeholder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkency%2Fimage_placeholder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkency%2Fimage_placeholder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arkency","download_url":"https://codeload.github.com/arkency/image_placeholder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224341555,"owners_count":17295268,"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":[],"created_at":"2024-11-12T20:06:43.603Z","updated_at":"2026-03-14T14:35:06.566Z","avatar_url":"https://github.com/arkency.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ImagePlaceholder\n\nRack middleware that intercepts not found image requests and replaces them with [placeholders](https://www.hanselman.com/blog/TheInternetsBestPlaceholderImageSitesForWebDevelopment.aspx). Useful for your development data references uploaded images but static files are no longer where they're supposed to be 😅.\n\n[![Build Status](https://travis-ci.org/arkency/image_placeholder.svg?branch=master)](https://travis-ci.org/arkency/image_placeholder)\n[![Gem Version](https://badge.fury.io/rb/image_placeholder.svg)](https://badge.fury.io/rb/image_placeholder)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'image_placeholder'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install image_placeholder\n\n## Usage\n\nSimplest usage, with default values. Extensions `jpg` and `png` are matched and the placeholder image has 100x100 dimension:\n\n```ruby\n# config/environments/development.rb\n\nRails.application.configure do\n  config.middleware.use ImagePlaceholder::Middleware\nend\n```\n\nProviding your own list of image extensions:\n\n```ruby\n# config/environments/development.rb\n\nRails.application.configure do\n  config.middleware.use ImagePlaceholder::Middleware, image_extensions: %w(jpg jpeg png webp gif)\nend\n```\n\nProviding your own sizes per request path. First regular expression match wins, so start with most specific ones:\n\n```ruby\n# config/environments/development.rb\n\nRails.application.configure do\n  config.middleware.use ImagePlaceholder::Middleware, size_pattern: {\n    %r{/uploads/.*/s_[0-9]+\\.[a-z]{3}$}  =\u003e 200,  # /uploads/product/cover/42/s_9781467775687.jpg\n    %r{/uploads/.*/xl_[0-9]+\\.[a-z]{3}$} =\u003e 750,  # /uploads/product/cover/42/xl_9781467775687.jpg\n    %r{.*} =\u003e 1024,                               # /uploads/random/spanish_inquisition.png\n  }\nend\n```\n\nYou can even change placeholder image host, if for example you prefer [fillmurray](https://fillmurray.com):\n\n```ruby\nRails.application.configure do\n  config.middleware.use ImagePlaceholder::Middleware, size_pattern: { /.*/ =\u003e '320/320' }, host: 'fillmurray.com'\nend\n```\n\nLast but not least, this middleware can be used with any Rack application:\n\n```ruby\n# config.ru\nuse ImagePlaceholder::Middleware, size_pattern: { /.*/ =\u003e '320/320' }, host: 'fillmurray.com'\nrun YourRackApp\n```\n\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/arkency/image_placeholder.\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## About\n\n\u003cimg src=\"http://arkency.com/images/arkency.png\" alt=\"Arkency\" width=\"14%\" align=\"left\" /\u003e\n\nThis gem is funded and maintained by [Arkency](http://blog.arkency.com). Check out our other [open-source projects](https://github.com/arkency).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farkency%2Fimage_placeholder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farkency%2Fimage_placeholder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farkency%2Fimage_placeholder/lists"}