{"id":16380995,"url":"https://github.com/anthonator/paperclip-dimension-validator","last_synced_at":"2025-03-21T01:32:36.726Z","repository":{"id":18903278,"uuid":"22121644","full_name":"anthonator/paperclip-dimension-validator","owner":"anthonator","description":"Validate image height and width for Paperclip","archived":false,"fork":false,"pushed_at":"2016-06-07T13:58:00.000Z","size":201,"stargazers_count":15,"open_issues_count":1,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T19:46:51.732Z","etag":null,"topics":["paperclip","rails-validations"],"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/anthonator.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":"2014-07-22T21:33:31.000Z","updated_at":"2023-03-17T12:03:36.000Z","dependencies_parsed_at":"2022-08-05T01:15:19.960Z","dependency_job_id":null,"html_url":"https://github.com/anthonator/paperclip-dimension-validator","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/anthonator%2Fpaperclip-dimension-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonator%2Fpaperclip-dimension-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonator%2Fpaperclip-dimension-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonator%2Fpaperclip-dimension-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anthonator","download_url":"https://codeload.github.com/anthonator/paperclip-dimension-validator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244721575,"owners_count":20498978,"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":["paperclip","rails-validations"],"created_at":"2024-10-11T03:53:05.913Z","updated_at":"2025-03-21T01:32:36.397Z","avatar_url":"https://github.com/anthonator.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# paperclip-dimension-validator\n\nValidate them dimensions!\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'paperclip-dimension-validator'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install paperclip-dimension-validator\n\n## Usage\n\nThis gem introduces the ```dimensions``` validator for Paperclip's\n```validates_attachment```. ```dimensions``` accepts a hash of ```height``` and\n``` width``` integer pixel values.\n\n**Example**\n```ruby\nclass Image \u003c ActiveRecord::Base\n  has_attached_file :avatar\n\n  validates_attachment :avatar, dimensions: { height: 30, width: 30 }\nend\n```\n\n## Testing\n\npaperclip-dimension-validator includes rspec-compatible matchers for testing.\n\n**Note** In order to use these matchers make sure to include either [chunky_png](https://github.com/wvanbergen/chunky_png) or\n[oily_png](https://github.com/wvanbergen/oily_png) as a dependency in your Gemfile.\n\n**Gemfile**\n\n```ruby\ngroup :test do\n  gem 'chunky_png'\nend\n```\n\n**RSpec**\n\nIn spec_helper.rb, you'll need to require the matchers:\n\n```ruby\nrequire 'paperclip/matchers/validate_attachment_dimesions_matcher'\n```\n\nAnd include the paperclip matchers module:\n\n```ruby\nRSpec.configure do |config|\n  config.include Paperclip::Shoulda::Matchers\nend\n```\n\n**Example**\n\n```ruby\nit { should validate_attachment_dimensions(:avatar).height(30).width(30) }\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanthonator%2Fpaperclip-dimension-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanthonator%2Fpaperclip-dimension-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanthonator%2Fpaperclip-dimension-validator/lists"}