Output fleximage image from DB?

I’m a bit stuck trying to output a DB-stored file in a view with
FlexImage 2. DB storing is supported but there is no documentation on
how to get it out of the DB. Could someone point me to a resource
explaining how to render a DB stored FlexImage in a view?

Here’s the documentation for a start, I’ve been using FlexImage for a
while now

http://wiki.github.com/Squeegy/fleximage

Since the latest code is for RESTful style controllers/views, etc. You’d
do something like this in your view that you’re placing your image in.

@image = Image.find(:first)

<%= image_tag formatted_image_path(@image, :jpg) %>

This would generate something like this…

which would map to the ImagesController, something like…

class ImagesController < ApplicationController

def show
@image = Image.find(params[:id])
end

end

this would then render the flexi template which might then look like
this.

app/views/images/show.jpg.flexi:
@image.operate do |i|
i.resize ‘200’
end

I hope this helps or at least the documentation link does.

RobL

Thanks for responding. I think my problem comes from rendering a
collection through partials. It is not calling the ‘show’ method and
therefore not triggering the routing call to .jpg. But my best effort
still doesn’t work:

VIEW
<%= image_tag(url_for(:controller => ‘questions’, :action => ‘show’, :id
=> question, :format => ‘jpg’) %>

returns:

but just has a broken image link. Its not getting the data.

QUESTIONS_CONTROLLER:
def show
@question = Question.find(params[:id])

respond_to do |format|
  format.html # show.html.erb
  format.xml  { render :xml => @question }
  format.jpg #for fleximage
end

/QUESTIONS/VIEW.SHOW.JPG.FLEXI:
@question

ROUTES.RB
map.resources :questions

Taylor S. wrote:

Going to the image directly by /questions/show/1.jpg yields the
following error:

NoMethodError in QuestionsController#show

undefined method `call’ for Fleximage::View:Class

This continues to be my sticking point. The server throws these errors
silently. More info on the error:

NoMethodError (undefined method `call’ for Fleximage::View:Class):

/Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_view/renderable.rb:21:in 

`_unmemoized_compiled_source’

This is on Rails 2.2.2. When installing I also had to change this line
in plugins/fleximage/init.rb

FROM
ActionView::Base.register_template_handler :flexi, Fleximage::View

TO
ActionView::Template.register_template_handler :flexi, Fleximage::View

So I wonder if there are other issues at work. Anyone on Edge rails
running fleximage ok? I can get the images to work when I use
embedded_image_tag but have had issues with image corruption really
blowing up my app. (have to drop the row from DB) Man, you spend more
time troubleshooting and shoehorning plugins than you do just writing
the functions from scratch!

Issue resolved. Somehow I had downloaded an old version of the plugin
from GitHub. The Dec 12th build solves everything. I love Mondays.

Going to the image directly by /questions/show/1.jpg yields the
following error:

NoMethodError in QuestionsController#show

undefined method `call’ for Fleximage::View:Class