hensleyl / paperclipped forked from kbingman/paperclipped

Radiant extension for managing assets and images with the Paperclip plugin

This URL has Read+Write access

name age message
file .gitignore Loading commit data...
file HELP_admin.markdown Wed Apr 29 04:22:24 -0700 2009 added s3 configuration [Keith Bingman]
file LICENSE Wed Apr 29 04:22:24 -0700 2009 added s3 configuration [Keith Bingman]
file README Sat Jan 10 08:46:21 -0800 2009 update README Signed-off-by: Keith BIngman <ke... [brianjlandau]
file Rakefile Wed Apr 29 04:22:24 -0700 2009 added s3 configuration [Keith Bingman]
directory app/
directory db/ Sat Jan 10 08:46:20 -0800 2009 make sure the column exists Signed-off-by: Kei... [brianjlandau]
directory lib/ Mon Feb 09 06:33:12 -0800 2009 don't assume a style when exporting paths [bryanl]
file paperclipped_extension.rb
directory psds/ Wed Apr 29 04:22:24 -0700 2009 added s3 configuration [Keith Bingman]
directory public/
directory spec/ Fri May 02 01:24:21 -0700 2008 paperclip import [Keith Bingman]
directory vendor/ Fri Jan 09 05:25:46 -0800 2009 cleaning up some OSX goodness [Keith Bingman]
README
Paperclipped
---

Paperclip is a new file management plugin from Thoughtbot which has a  few advantages over attachment_fu: it doesn't use 
RMagick, which uses a lot of RAM and is a bit of overkill for just making thumbnails. Instead it directly uses 
ImageMagick, making it much easier to install. 


###Installation

To install paperclipped, just run 
 
  rake production db:migrate:extensions
  rake production radiant:extensions:paperclipped:update

This runs the database migrations and installs the javascripts, images and css.

###Configuration

If you install the Settings Extension (highly recommended), you can also easily adjust both the sizes of any additional 
thumbnails and which thumbnails are displayed in the image edit view. The default is the original file, but any image 
size can be used by giving in the name of that size. 

If you do install the Settings Extension you should be sure to add a config.exetensions line to your environment.rb 
file: 

   config.extensions = [ :settings, :all ]
   
Also the Settings Extension migration should be run before Paperclipped's migration.

The configuration settings also enable a list of the allowed file types, maximum file size and should you need it, the 
path to your installation of Image Magick (this should not be needed, but I sometimes had a problem when using 
mod_rails).

###Using Paperclipped

Once installed, you get a new Tab with the entire assets library, a Bucket à la Mephisto (though only the concept is s
tolen) and a search. You can also easily attach assets to any page and directly upload them to a page.

###Asset Tags

There are a veriety of new tags. The basic tag is the <code><r:assets /></code> tag, which can be used either alone or 
as a double tag. This tag requires the "title" attribute, which references the asset. If you use the drag and drop from 
the asset bucket, this title will be added for you. 

The <code><r:assets /></code> tag can be combined with other tags for a variety of uses: 

  <r:assets:image title="foo" /> will return <img src="/path/to/foo" alt="foo" />

  <r:assets:link title="foo" /> will return <a href="/path/to/foo">foo</a>

You could also use: 

  <r:assets:link title="foo" text="This is the link to foo" /> will return <a href="/path/to/foo">This is the link to 
  foo</a>

or 

  <rassets:link title="foo">This is another link</r:link>

Asset links are also available, such as content_type, file_size, and url. 

Another important tag is the <code><r:assets:each>...</r:assets:each></code>. If a page has attached assets, the 
assets:each tag will cycle through each asset. You can then use an image, link or url tag to display or connect your 
assets. 

Thumbnails are automatically geneerated for images when the images are uploaded. By default, two sizes are made for use 
within the extension itself. These are "icon" 42px by 42px and "thumbnail" which is fit into 100px, maintaining its 
aspect ratio. 

###Migrating from the page_attachments extension

If you're moving from page_attachments to paperclipped, here's how to migrate smoothly;

First, remove or disable the page_attachments extension, and install the paperclipped extension.
For example:

  rake ray:dis name=page_attachments
  rake ray:assets
  
The migration has now copied your original page_attachments table to old_page_attachments.

  rake radiant:extensions:paperclipped:migrate_from_page_attachments
  
This rake task will create paperclipped-style attachments for all OldPageAttachments. It will also ask you if you want 
to clean up the old table and thumbnails in /public/page_attachments.

Done!