Forum: Ruby on Rails RE: Showing Images from a file store

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2006-04-12 23:15
(Received via mailing list)
Hi John,
Thanks for the quick response.
I wanted to show the image along with other data from the controller.
How do I do that. Looks like I am not understanding it.
 <td><%= column1 from  the model%>
 <td><%= column1 from  the model%>
 <td><%= column1 from  the model%>
 <td><%= send_file '\\xx.xx.xxx.xx\xx\xx\xxx\abc.gif"',
			  		:type => 'image/jpeg',
			  		:disposition => 'inline'%>

Would not work. Sorry for my ignorance.

Thanks
Silvy Mathews
Josh K. (Guest)
on 2006-04-12 23:39
(Received via mailing list)
On 4/12/06, removed_email_address@domain.invalid 
<removed_email_address@domain.invalid> wrote:

> I wanted to show the image along with other data from the controller.
> How do I do that. Looks like I am not understanding it.
> ...
> <td><%= send_file '\\xx.xx.xxx.xx\xx\xx\xxx\abc.gif"',
>                                         :type => 'image/jpeg',
>                                         :disposition => 'inline'%>
>


Silvy,

What you want to do is set up a controller that handles the dispatching
of
the images.  It is there that you would have the send_file command.
Remember that in HTTP you are going to have seperate request for each
item
on the page, so map the new controller url using routes and use that url
in
your view, for example "/dynamicimages/abc.gif".

Does that make sense?

Josh
unknown (Guest)
on 2006-04-13 04:18
(Received via mailing list)
Yea sorry my response was a little short - that function would go in the
controller, i.e.

class FileGrabberController < ApplicationController
   def grab_file
      send_file '/path', :type => 'image/jpeg', [etc]
   end
end

then either call the controller directly using an image tag or use a
helper..
let me know if that helps - I can post a working example when I get home
tonight [on the laptop at home]..





Quoting removed_email_address@domain.invalid:
This topic is locked and can not be replied to.