Repository is archived
No commit activity in last 3 years
No release in over 3 years
Using paperclip to generate images from sensible attributes like e-mails and telephone numbers, in order to reduce crawler's success
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

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".