Greg Hauptmann
2009-Sep-20 21:07 UTC
current best approach for Sending Files (streaming files e.g. images) in rails???
Hi, Q1 - What''s the current most popular approach (plugin/gem or otherwise) for sending files / streaming files (e.g. images) back to a browser? Q2 - Noting I''m on Dreamhost.com on a shared environment (so don''t get much access to Apache), I was going to stick the images in mysql. Should keep things simple. Later if the service really gets used or response times are an issue I could change this approach (store them in a directory I create in the Rails app, but not under /public I guess). This should be OK no? Again I''m not sure how much access to Apache with Dreamhost.com shared platform I would have and whether there would be a well known more performant option here. http://wiki.dreamhost.com/Apache Background - So the main page would be referencing these images via a Rails controller to ensure authentication occurs. So it''s the standard scenario of allowing a user to upload files/images, but when they download them how to serve this back to them in an efficient fashion. Tks
Gavin
2009-Sep-21 07:41 UTC
Re: current best approach for Sending Files (streaming files e.g. images) in rails???
Greg - Check out http://api.rubyonrails.org/classes/ActionController/Streaming.html#M000421 On Sep 20, 10:07 pm, Greg Hauptmann <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > Q1 - What''s the current most popular approach (plugin/gem or > otherwise) for sending files / streaming files (e.g. images) back to a > browser? > > Q2 - Noting I''m on Dreamhost.com on a shared environment (so don''t get > much access to Apache), I was going to stick the images in mysql. > Should keep things simple. Later if the service really gets used or > response times are an issue I could change this approach (store them > in a directory I create in the Rails app, but not under /public I > guess). This should be OK no? Again I''m not sure how much access to > Apache with Dreamhost.com shared platform I would have and whether > there would be a well known more performant option here.http://wiki.dreamhost.com/Apache > > Background - So the main page would be referencing these images via a > Rails controller to ensure authentication occurs. So it''s the > standard scenario of allowing a user to upload files/images, but when > they download them how to serve this back to them in an efficient > fashion. > > Tks
Marnen Laibow-Koser
2009-Sep-21 12:43 UTC
Re: current best approach for Sending Files (streaming files
Greg Hauptmann wrote:> Hi, > > Q1 - What''s the current most popular approach (plugin/gem or > otherwise) for sending files / streaming files (e.g. images) back to a > browser?Put them in the public directory. That way Rails'' involvement is minimized.> > Q2 - Noting I''m on Dreamhost.com on a shared environment (so don''t get > much access to Apache), I was going to stick the images in mysql. > Should keep things simple.No, actually it will complicate things, or so say people who''ve done it this way. Images belong in the filesystem, not the DB. [...]> > Background - So the main page would be referencing these images via a > Rails controller to ensure authentication occurs. So it''s the > standard scenario of allowing a user to upload files/images, but when > they download them how to serve this back to them in an efficient > fashion.Have you bothered to read the recent discussions on this list? There''s always a lot of talk of using Paperclip and send_file for exactly this. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org> > Tks-- Posted via http://www.ruby-forum.com/.