Image_tag and send_data

i’m storing images in database.

i have this action in controller:

def image
begin
item = StoredItem.find(:first, :conditions => {:id =>
params[:id]})
rescue
return
end
return if item.nil?

if item.image_binary.nil?
  render :nothing => true
else
  send_data(item.image_binary, :type => item.image_datatype,

:disposition => ‘inline’) unless item.image_binary.nil?
end
end

and i have this code in view:

<%items.each do |item|%>

<%=image_tag(url_for(:action => :image, :id => item.id), :alt =>
item.name+’ image’, :size => ‘24x24’)%>

<%end>

everything works fine except that i have separate SELECT queries to
database on EACH loading image.

in view i’m iterating collection of “items”, so i have all neccessary
data and i don’t want to select it from database again. Is there any way
to use “send_data” directly from image_tag or something similar?