CyImage Extension

ConstantineYurevich edited this page Aug 24, 2010 · 3 revisions
Clone this wiki locally

Author: Constantine Yurevich
Homepage: http://github.com/ConstantineYurevich/radiant-cy-image-extension

CyImage extension can be used to implement on-fly image resizing using ImageMagick directly on your Radiant pages.

Requirements

1. ImageMagick should be installed
2. RMagick ruby gem should be installed (gem install rmagick)

Installation


  cd vendor/extensions  
  git clone git://github.com/ConstantineYurevich/radiant-cy-image-extension.git cy_image
  rake radiant:extensions:cy_image:update

Usage

Creating thumbnail with defined width and height:


  <r:cy_image:thumbnail src="/images/test.jpg" height="100" width="100" alt="Test image" />

Disproportionate resize with defined width and height:


  <r:cy_image:resize src="/images/test.jpg" height="100" width="100" alt="Test image" />

Proportional resize with defined either width or height:


  <r:cy_image:resize src="/images/test.jpg" width="100" alt="Test image" />
  <r:cy_image:resize src="/images/test.jpg" height="100" alt="Test image" />

Each tag will generate appx. the following code:


  <img src="/images/cy_image/cache/test_cfd24216cc89c683a44574931c3da509.jpg" height="100" alt="Test image" width="100" />

Where “/images/cy_image/cache/test_cfd24216cc89c683a44574931c3da509.jpg” is chached path of modified/resized/cropped image.