CyImage extension can be used to implement on-fly image resizing using ImageMagick directly on your Radiant pages.
-
ImageMagick should be installed
-
RMagick ruby gem should be installed (gem install rmagick)
cd vendor/extensions git clone git://github.com/ConstantineYurevich/radiant-cy-image-extension.git cy_image rake radiant:extensions:cy_image:update
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.