Full-stack asset management for Ruby on Rails. With Paperclip, SWFUpload, jQuery, jgrow, Jcrop and Facebox.
JavaScript Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
app
config
generators
lib
public
rails
tasks
test
.gitignore
MIT-LICENSE
README.rdoc
Rakefile
TODO.txt
VERSION
demo.txt
init.rb
install.rb
uninstall.rb

README.rdoc

Papermill

  • Asset management made easy, 10 minutes integration.

  • All-you-can-eat glue around Polymorphic Paperclip table, SWFUpload & JQuery.

  • Associate any image or list of images with any model and any key.

Install the gem

sudo gem install papermill

Try the demo

rails -m http://github.com/bbenezech/papermill/raw/master/demo.txt papermill-example

Out-of-the-box compatibility with :

  • Formtastic # use :as => :[image|asset](s)_upload

  • JGrowl # for notifications (included)

  • FaceBox # for popups (included)

  • Stringex # (or any String#to_url) for asset filename/url generation

Navigator minimal requirements:

  • IE6+

  • Flash 9+

  • Javascript ON

Check your audience.

Server requirements:

  • Rails option for URI

  • an optional copyright (©) flag # will use copyright text after the “©” or options

Examples:

image_tag @article.covers.first.url("100x100")
image_tag @article.covers.first.url("original©")
image_tag @article.covers.first.url("100x100#-wm©")
image_tag @article.covers.first.url("100x200#©papermill")

2. Papermill Alias

Those are application-wide, set them in the options

Consist of:

:geometry => "ImageMagick-geometry-string"
:copyright => true | "copyright"    # If true, the asset copyright field will be used. Edit the asset.
:watermark => true | URI            # If true, will use options[:watemark]

Examples:

#config/initilializers/papermill.rb

# snip
:aliases => {
  :thumb_copyrighted => {
    :geometry => "100x100",
    :copyright => "papermill",
  },
  :thumb_copyrighted_dynamically => {
    :geometry => "100x100",
    :copyright => true
  },
  :thumb_watermarked_with_rails => {
    :width => "100",
    :height => "100",
    :watermark => "/images/rails.png"
  }
}

Then in your views, simply do

image_tag @article.covers.first.url(:thumb_copyrighted)

3. Papermill Hash

Same as aliases, but defined directly in #url!() Plus you can add a :name that will be used for style-name (defaults to a md5 of the hash)

Example:

image_tag @article.covers.first.url(
  :geometry => "100x100",
  :watermark => "/images/rails.png",
  :copyright => "papermill",
  :name => "thumbnail_watermarked_and_copyrighted"
)

Resource access

Papermill generates an #<association_key> association

@entry.mug_shots.first
@entry.diaporamas.each do |image| ..
# etc.

Using PapermillAsset

@asset = @entry.mug_shots.first
image_tag @asset.url              # original
image_tag @asset.url("100x>")     # assuming asset is an image
image_tag @asset.url(:big)        # assuming you have a :big alias
@asset.name
@asset.content_type
@asset.path
@asset.path("100x>")
# etc.

Translations:

Papermill is fully I18n-able. Copy config/locales/papermill.yml to your root config/locale folder to modify any wording in a any locale.

Copyright © 2009 Benoit Bénézech, released under the MIT license