{"id":14969853,"url":"https://github.com/buck-ai/has_placeholder_image","last_synced_at":"2026-02-27T14:41:12.093Z","repository":{"id":40055180,"uuid":"277190179","full_name":"buck-ai/has_placeholder_image","owner":"buck-ai","description":"A Ruby gem for generating string based placeholder images in Rails. ","archived":false,"fork":false,"pushed_at":"2023-10-31T19:47:02.000Z","size":113,"stargazers_count":21,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-02T08:09:54.043Z","etag":null,"topics":["image-processing","ruby","ruby-gem","ruby-on-rails"],"latest_commit_sha":null,"homepage":"https://buck.ai","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/buck-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2020-07-04T21:50:04.000Z","updated_at":"2025-06-24T22:09:40.000Z","dependencies_parsed_at":"2024-10-11T04:00:40.761Z","dependency_job_id":"c72737cd-30b7-4493-9f36-fb28f84ca382","html_url":"https://github.com/buck-ai/has_placeholder_image","commit_stats":{"total_commits":49,"total_committers":3,"mean_commits":"16.333333333333332","dds":"0.12244897959183676","last_synced_commit":"0aa4b9714da84a3f97301da038820da6a26cc93a"},"previous_names":["buck-ai/has-placeholder-image"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/buck-ai/has_placeholder_image","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buck-ai%2Fhas_placeholder_image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buck-ai%2Fhas_placeholder_image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buck-ai%2Fhas_placeholder_image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buck-ai%2Fhas_placeholder_image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buck-ai","download_url":"https://codeload.github.com/buck-ai/has_placeholder_image/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buck-ai%2Fhas_placeholder_image/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29899986,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T14:30:36.354Z","status":"ssl_error","status_checked_at":"2026-02-27T14:30:01.989Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["image-processing","ruby","ruby-gem","ruby-on-rails"],"created_at":"2024-09-24T13:42:30.212Z","updated_at":"2026-02-27T14:41:12.065Z","avatar_url":"https://github.com/buck-ai.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HasPlaceholderImage\n![Test](https://github.com/buck-ai/has-placeholder-image/workflows/Test/badge.svg)\n[![Maintainability](https://api.codeclimate.com/v1/badges/d7ff2ca5f9ceb238c353/maintainability)](https://codeclimate.com/github/buck-ai/has_placeholder_image/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/d7ff2ca5f9ceb238c353/test_coverage)](https://codeclimate.com/github/buck-ai/has_placeholder_image/test_coverage)\n[![Gem Version](https://badge.fury.io/rb/has_placeholder_image.svg)](https://badge.fury.io/rb/has_placeholder_image)\n\n\nHas Placeholder Image is a Ruby on Rails plugin that allows developers to generate placeholder images for models that has ActiveStorage fields.\n\n## Installation\nAdd this line to your application's Gemfile:\n```ruby\ngem 'has_placeholder_image'\n```\n\nAnd then execute:\n```bash\n$ bundle\n```\n\nOr install it yourself as:\n```bash\n$ gem install has_placeholder_image\n```\n\nafter generate configuration file with this command;\n```shell script\nrails g has_placeholder_image:install\n```\n\n## Usage\nInsert this method to your model which will have placeholder images:\n \n `has_placeholder_image`\n\nYou can customize default configuration with `config/initializers/has_placeholder_image.rb` or you can customize placeholder image generation on model basis by adding custom attributes to placeholder callback.\n\nFor example;\n```ruby\nhas_placeholder_image source: :title, \n                      target: :logo, \n                      background_color: '#335eea'\n```\n\n## Configuration\n\nThe default configuration lies in `config/initializers/has_placeholder_image.rb` and can be customized according to your liking.\n\n```ruby\nHasPlaceholderImage.setup do |config|\n  config.background_color = '#000000'\n  config.font_color = '#FFFFFF'\n  config.font_size = 200\n  config.transformer = 'two_word_first_letter_upcase'\n  config.source = 'name'\n  config.target = 'photo'\n  config.output_path = 'tmp/placeholders'\n  config.height = 300\n  config.width = 300\nend\n```\n\n| Key | Description |\n| --- | ----------- |\n| `background_color` | For image background color. |\n| `font_color` | For text color. |\n| `font_size` | For font size. |\n| `transformer` | How to generate your image title. This time only have `'two_word_first_letter_upcase'` method. |\n| `source` | Placeholder image text generate with this field. |\n| `target` | Your active storage attribute on your model. |\n| `output_path` | Where to store generated images path. |\n| `height` | Generated image height. |\n| `width` | Generated image width. |\n\n## Example\napp/models/company.rb\n```ruby\n# frozen_string_literal: true\n\nclass Company \u003c ApplicationRecord\n  has_one_attached :logo\n  has_placeholder_image source: :title, target: :logo,\n                        background_color: '#335eea',\n\t\t\t            font_size: 200\n\n  validates :title, presence: true\nend\n```\n![Output](docs/example.png)\n\n\n## Contributing\nSee the contributing guide.\n\n## License\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuck-ai%2Fhas_placeholder_image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuck-ai%2Fhas_placeholder_image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuck-ai%2Fhas_placeholder_image/lists"}