fleximage : caching issue

fleximage plugin is working great. but I’m running into issues with caching.

The doc says

Now when page caching is active, the size is baked into the filename.

Does it mean that I must use page level caching. I can’t use page level caching since the pages are dynamic. I thought of using fragement caching but here also I ran into issue. Here is my controller

class ProductImagesController < ApplicationController

flex_image :action => ‘show’,:class => ProductImage
flex_image :action => ‘small’,:class => ProductImage,:size => ‘100x40’

flex_image :action => ‘medium’,:class => ProductImage,:size => ‘250x165’

def create
img = ProductImage.create(:data => params[:image][:data])
redirect_to :action => ‘show’, :id => img

end
end

I also have following lines in routes.

map.product_image ‘product_images/show/:id/:size/image.jpg’,
:controller => ‘product_images’,
:action => ‘show’

the url to get the image is
http://localhost/product_images/medium/5/image.jpg

Here I don’t even get an opportunity to do fragement chaching since there is no method in my controller called medium.

Does anyone have snippet of code explaining how to do caching with fleximage?

Thanks.

  • Neeraj