bill walton
2010-May-03 18:08 UTC
how-to display an image living outside the public directory
I''m trying to display an image (chart) that lives outside the public directory in RAILS_ROOT/private. The chart contains confidential information and so can''t live in /public or any sub-directories of /public. The chart needs to be displayed from a partial. The first display of the page containing the partial is an html render. Subsequently, the user can select a different chart causing an ajax call which replaces the content of the image-containing dom element in the partial with a new chart image. Any thoughts / pointers are much appreciated! Best regards, Bill -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Robert Walker
2010-May-03 19:11 UTC
Re: how-to display an image living outside the public direct
bill walton wrote:> I''m trying to display an image (chart) that lives outside the public > directory in RAILS_ROOT/private.You probably looking for send_file: http://railsapi.com/doc/rails-v2.3.5/classes/ActionController/Streaming.html#M001587 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
bwalton.im
2010-May-03 21:01 UTC
Re: Re: how-to display an image living outside the public direct
Hi Rob, On Mon, May 3, 2010 at 2:11 PM, Robert Walker <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> bill walton wrote: > > I''m trying to display an image (chart) that lives outside the public > > directory in RAILS_ROOT/private. > > You probably looking for send_file: >Yeah. I was trying to use send_data and it wasn''t working. Not sure why, but send_file does. I got it working but gmail doesn''t send my own posts to me so couldn''t reply that I''d solved it. Thanks much for replying. I appreciate it. Best regards, Bill -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Vladimir Rybas
2010-May-04 03:33 UTC
Re: how-to display an image living outside the public directory
You could have PrivateImagesController with `show` method and you will get your images through /private_images/image_name.png in `show` method (check permissions) send_file "#{RAILS_ROOT}/private_images_folder/#{params[:image_name]}" send_file is really slow and will work only when there''s not a lot of users requesting files In Nginx you could use x-send-file option or something, which makes send_file work much better. I didn''t try that though. On Tue, May 4, 2010 at 1:08 AM, bill walton <bwalton.im-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m trying to display an image (chart) that lives outside the public > directory in RAILS_ROOT/private. > > The chart contains confidential information and so can''t live in /public > or any sub-directories of /public. > > The chart needs to be displayed from a partial. The first display of > the page containing the partial is an html render. Subsequently, the > user can select a different chart causing an ajax call which replaces > the content of the image-containing dom element in the partial with a > new chart image. > > Any thoughts / pointers are much appreciated! > > Best regards, > Bill > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.