Skip to content

An extension for radiant to allow dynamic image generation through RMagick

Notifications You must be signed in to change notification settings

metcalf/radiant-dynamic-image-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

== Dynamic Image Generator Extension ==

	Created by Andrew Metcalf
	Inspired by Dynamic Text Replacement by Stewart Rosenberger (http://www.alistapart.com/articles/dynatext)
	
Generates images from text using RMagick

== Setup ==
1. Copy the extension directory into your vendor/extensions folder
2. Place a font file in a known directory on your server.
3. Create a folder called "dynamic_images" in public and chmod 755 it
4. Configure default text settings in environment.rb.  Here are some sample settings

Radiant::Config['image.font'] = "#{RAILS_ROOT}/CenturyGothic-Bold.ttf" # Font path
Radiant::Config['image.size'] = 28.0 # Font size
Radiant::Config['image.spacing'] = 5 # Spacing between words in pixels
Radiant::Config['image.color'] = '#8FC757,#0093DB' # Colors, if multiple colors are provided each word will be a different color
Radiant::Config['image.cache_path'] = 'public/dynamic_images' # Path to cache the images, don't change this now
Radiant::Config['image.background'] = '#0D0D0D' # Background color of the image or 'transparent' for transparent background (may have problems in IE)

== Usage ==
<r:image>Text to turn into image</r:image>

To customize the characteristics of the image you can set attributes in the tag (font, size, spacing, color, background)
For example <r:image size="19">My Text</r:image>

You can also add HTML attributes which will be passed through,
<r:image id="my_id">My Text</r:image>

About

An extension for radiant to allow dynamic image generation through RMagick

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages