Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

attribute_imagifiable

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

attribute_imagifiable

  • 0.0.8
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

AttributeImagifiable

Using paperclip to generate images from sensible attributes like e-mails and telephone numbers, in order to reduce crawler's success

Installation

Add this line to your application's Gemfile:

gem 'attribute_imagifiable'

And then execute:

$ bundle

Or install it yourself as:

$ gem install attribute_imagifiable

Usage

  1. Generate Paperclip attachments
rails g paperclip person email_image
rails g paperclip person telephone_image
rake db:migrate
  1. Include and use in your Models:

class Person < ActiveRecord::Base
...

  has_attached_file :telephone_image,
                    styles: {small: "150x105>"},
                    url: '/system/:class/:attachment/:id/:style/:filename'
  has_attached_file :email_image,
                    styles: {small: "150x105>"},
                    url: '/system/:class/:attachment/:id/:style/:filename'
  include AttributeImagifiable
  attribute_imagifiable :telephone, as: :telephone_image
  attribute_imagifiable :email, as: :mail_image

This will automatically generate an image for the "telephone" and "email" attribute before each update, if that attribute changed.

attribute_imagifiable takes an optional :font parameter with path to a system ttf font. Default is "/usr/share/fonts/truetype/msttcorefonts/Verdana.ttf".

FAQs

Package last updated on 31 Jul 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc