Skip to content
Squeegy edited this page Sep 12, 2010 · 3 revisions

You don’t want to render JPGs? That’s fine. Just link to the format you want (:jpg, :gif or :png) with a formatted route, and declare the your template name to match. Fleximage will detect the desired format and and the image will be rendered properly. For instance, this will render a .gif.

# app/views/photos/show.html.erb
<%= image_tag photo_path(@photo, :gif) %>

# app/views/photos/show.gif.flexi
@photo.operate do |image|
  @photo.resize '150x150', :crop => true
end

This will work for :jpg, :gif or :png, although most of the time, :jpg is recommended for the best quality to filesize ratio.

Clone this wiki locally