{"id":13878055,"url":"https://github.com/imgproxy/imgproxy-rails","last_synced_at":"2025-07-16T14:30:51.564Z","repository":{"id":196159134,"uuid":"674365206","full_name":"imgproxy/imgproxy-rails","owner":"imgproxy","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-16T08:29:24.000Z","size":85,"stargazers_count":95,"open_issues_count":1,"forks_count":2,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-11-16T07:18:58.067Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/imgproxy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2023-08-03T19:11:46.000Z","updated_at":"2024-11-02T09:25:39.000Z","dependencies_parsed_at":"2024-07-16T10:50:35.070Z","dependency_job_id":null,"html_url":"https://github.com/imgproxy/imgproxy-rails","commit_stats":null,"previous_names":["evilmartians/imgproxy-rails"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imgproxy%2Fimgproxy-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imgproxy%2Fimgproxy-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imgproxy%2Fimgproxy-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imgproxy%2Fimgproxy-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imgproxy","download_url":"https://codeload.github.com/imgproxy/imgproxy-rails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226134226,"owners_count":17578778,"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-08-06T08:01:38.610Z","updated_at":"2025-07-16T14:30:51.544Z","avatar_url":"https://github.com/imgproxy.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://imgproxy.net\"\u003e\n    \u003cpicture\u003e\n      \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"assets/logo-dark.svg?sanitize=true\"\u003e\n      \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"assets/logo-light.svg?sanitize=true\"\u003e\n      \u003cimg alt=\"imgproxy logo\" src=\"assets/logo-light.svg?sanitize=true\"\u003e\n    \u003c/picture\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cstrong\u003e\n  \u003ca href=\"https://imgproxy.net\"\u003eWebsite\u003c/a\u003e |\n  \u003ca href=\"https://imgproxy.net/blog/\"\u003eBlog\u003c/a\u003e |\n  \u003ca href=\"https://docs.imgproxy.net\"\u003eDocumentation\u003c/a\u003e |\n  \u003ca href=\"https://imgproxy.net/#pro\"\u003eimgproxy Pro\u003c/a\u003e\n\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/imgproxy/imgproxy/pkgs/container/imgproxy\"\u003e\u003cimg alt=\"Docker\" src=\"https://img.shields.io/badge/Docker-0068F1?style=for-the-badge\u0026logo=docker\u0026logoColor=fff\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://bsky.app/profile/imgproxy.net\"\u003e\u003cimg alt=\"Bluesky\" src=\"https://img.shields.io/badge/Bluesky-0068F1?style=for-the-badge\u0026logo=bluesky\u0026logoColor=fff\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://x.com/imgproxy_net\"\u003e\u003cimg alt=\"X\" src=\"https://img.shields.io/badge/X.com-0068F1?style=for-the-badge\u0026logo=x\u0026logoColor=fff\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://mastodon.social/@imgproxy\"\u003e\u003cimg alt=\"X\" src=\"https://img.shields.io/badge/Mastodon-0068F1?style=for-the-badge\u0026logo=mastodon\u0026logoColor=fff\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://discord.gg/5GgpXgtC9u\"\u003e\u003cimg alt=\"Discord\" src=\"https://img.shields.io/badge/Discord-0068F1?style=for-the-badge\u0026logo=discord\u0026logoColor=fff\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/imgproxy/imgproxy-rails/actions\"\u003e\u003cimg alt=\"GH Test\" src=\"https://img.shields.io/github/actions/workflow/status/imgproxy/imgproxy-rails/rspec.yml?branch=master\u0026label=Test\u0026style=for-the-badge\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/imgproxy/imgproxy-rails/actions\"\u003e\u003cimg alt=\"GH Test Jruby\" src=\"https://img.shields.io/github/actions/workflow/status/imgproxy/imgproxy-rails/rspec-jruby.yml?branch=master\u0026label=Test%20JRuby\u0026style=for-the-badge\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/imgproxy/imgproxy-rails/actions\"\u003e\u003cimg alt=\"GH Lint\" src=\"https://img.shields.io/github/actions/workflow/status/imgproxy/imgproxy-rails/rubocop.yml?branch=master\u0026label=Lint\u0026style=for-the-badge\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://rubygems.org/gems/imgproxy-rails\"\u003e\u003cimg alt=\"Gem\" src=\"https://img.shields.io/gem/v/imgproxy-rails.svg?style=for-the-badge\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://www.rubydoc.info/gems/imgproxy-rails\"\u003e\u003cimg alt=\"rubydoc.org\" src=\"https://img.shields.io/badge/rubydoc-reference-blue.svg?style=for-the-badge\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\nSeamless integration of [imgproxy](https://imgproxy.net)–a fast and secure standalone server for resizing and converting remote images–to your Rails app with zero changes to your codebase required.\n\nWhile [imgproxy.rb](https://github.com/imgproxy/imgproxy.rb) being a framework-agnostic Ruby gem includes proper support for Rails' most popular image attachment options: [Active Storage](https://edgeguides.rubyonrails.org/active_storage_overview.html) and [Shrine](https://github.com/shrinerb/shrine), it requires user to use imgproxy specific API:\n\n```ruby\nuser.avatar.imgproxy_url(width: 250, height: 250)\n```\n\nBut wouldn't that be awesome to keep using existing variant syntax? For example, to use vips/ImageMagick in dev and imgproxy in production?\n\nAnd `imgproxy-rails` gem provides just that, thanks to [ActiveStorage::Variant API](https://api.rubyonrails.org/v7.1.3/classes/ActiveStorage/Variant.html) and [Proxy mode](https://guides.rubyonrails.org/active_storage_overview.html#proxy-mode).\n\n## Installation\n\nAdd to your project:\n\n```ruby\n# Gemfile\ngem \"imgproxy-rails\"\n```\n\n### Supported Ruby versions\n\n- Ruby (MRI) \u003e= 2.7.0\n- JRuby \u003e= 9.3.0\n\n### Supported Rails versions\n\n- Rails \u003e= 6.0.0\n\n## Usage\n\nGiven the following configuration:\n\n```ruby\n# development.rb\nconfig.active_storage.resolve_model_to_route = :rails_storage_proxy\n\n# production.rb\nconfig.active_storage.resolve_model_to_route = :imgproxy_active_storage\n```\n\nThe following HTML snippet will generate different URLs in dev and prod:\n\n```erb\n# show.erb.html\n\u003c%= image_tag Current.user.avatar.variant(resize: \"100x100\") %\u003e\n```\n\nIn dev, it will generate a URL like this:\n\n```html\n\u003cimg src=\"http://localhost:3000/rails/active_storage/blobs/proxy/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBWHc9IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--0c35e9a616c29da2dfa10a385bae7172526e7961/me.png\"\u003e\n```\n\nIn prod, it will generate a URL like this:\n\n```html\n\u003cimg src=\"https://imgproxy.example.com/8uVB2dYrZVOdG-1tekFjNJZ7s7VHDViXJbu9TcQavQ8/fn:me.png/aHR0cDovL2xvY2Fs/aG9zdDozMDAwL3Jh/aWxzL2FjdGl2ZV9z/dG9yYWdlL2Jsb2Jz/L3Byb3h5L2V5SmZj/bUZwYkhNaU9uc2li/V1Z6YzJGblpTSTZJ/a0pCYUhCQldIYzlJ/aXdpWlhod0lqcHVk/V3hzTENKd2RYSWlP/aUppYkc5aVgybGtJ/bjE5LS0wYzM1ZTlh/NjE2YzI5ZGEyZGZh/MTBhMzg1YmFlNzE3/MjUyNmU3OTYxL21l/LnBuZw\"\u003e\n```\n\nYou can also specify imgproxy-specific parameters in `imgproxy_options` attribute. Imgproxy-specific params will take precedence over ones from original API:\n\n```ruby\n# height=50 and width=50 will be applied\nCurrent.user.avatar.variant(resize: \"100x100\", imgproxy_options: {height: 50, width: 50})\n```\n\n### Generating video and PDF previews\n\nIf you are an imgproxy Pro user and you want to use it to generate previews for your videos and PDFs, just add their content types to the `variable_content_types` list:\n\n```ruby\nconfig.active_storage.variable_content_types \u003c\u003c \"application/pdf\"\nconfig.active_storage.variable_content_types \u003c\u003c \"video/mp4\"\nconfig.active_storage.variable_content_types \u003c\u003c \"video/mov\"\n# ...etc\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at [https://github.com/imgproxy/imgproxy-rails](https://github.com/imgproxy/imgproxy-rails).\n\n## Credits\n\nThis gem is generated via [new-gem-generator](https://github.com/palkan/new-gem-generator).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimgproxy%2Fimgproxy-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimgproxy%2Fimgproxy-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimgproxy%2Fimgproxy-rails/lists"}