Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simple asset management (images and other uploads) for Radiant.
JavaScript Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app
config
db/migrate
features/support
lib
public
spec
.gitignore
Gemfile
README.rdoc
Rakefile
assets_extension.rb
cucumber.yml
radiant-assets-extension.gemspec

README.rdoc

Assets

Provides simple image/attachment handling. Intended as a replacement for paperclipped in the long run, but very barebones right now.

Features:

  • Supports uploading of images as well as other files.

  • Uploading of multiple files at once

  • On-the-fly resizing of images to arbitrary sizes

  • Easy Attachment of assets to pages (and reordering them)

Example Radius Tags

<r:image size="300x" />

Proportionally resizes an image to 300px width. Supports imagemagick geometry strings to do advanced resizing straight in Radius tags. Resized images are cached in Radiant's built-in cache so they don't have to be re-created on every request.

<r:assets:caption />

Renders the current asset’s caption

<r:attachments:each />

Cycles through all assets that are attached to the current page

Configuration

You can change the behaviour of this extension using a number of Radiant settings.

assets.host

If this is set (defaults to not being set), the hostname given will be inserted into all URLs generated by the assets extension. If you set up a CNAME record in DNS that points to the Radiant app itself, this can improve performance of the site by enabling browser to download assets in parallel. It can also be used to configure a CDN such as Amazon’s CloudFront.

You will need to make sure this hostname points to the right content yourself.

Example:

Radiant::Config['assets.host'] = 'cdn.example.com'

assets.storage

This defaults to 'file'. Set this to 's3' to store all uploads in Amazon's S3 service. You will need to supply your Amazon AWS credentials as s3.key and s3.secret

Example:

Radiant::Config['assets.storage'] = 's3'
Radiant::Config['s3.key'] = 'asd123asdklj'
Radiant::Config['s3.secret'] = 'a1678123bcd123123efasdc'

s3.bucket

Set this to the s3 bucket name you want to use. If you don't set this, a bucket named “radiant-assets-extension” will be created and used.

s3.host

If your bucket is located in a region other than the Amazon default of us-east-1, set this to the appropriate host, e.g. s3-eu-west-1.amazonaws.com for the EU (Ireland) region.

Todo

  • Easy/Automatic migration from paperclipped (currently this extension should only be used on “fresh” radiant sites w/o an asset management solution already in place)

Something went wrong with that request. Please try again.