[Rails] Re: What's the best way to protect images from the public?

2009-07-03 Thread Gavin
Thanks Nicholas, I have used send_file before, but I had no idea that the 'inline' option was available. You've also helped answer the problem I've had with my mp3_player plugin (http://handyrailstips.com/tips/7-playing-mp3-s-on-your-rails- site-with-mp3_player) Thanks again :) Gavin --~--~-

[Rails] Re: What's the best way to protect images from the public?

2009-07-03 Thread Nicholas Henry
Just so you know, with the x-sendfile option: :x_sendfile - uses X-Sendfile to send the file when set to true. This is currently only available with Lighttpd/Apache2 and specific modules installed and activated. Since this uses the web server to send the file, this may lower memory consumption on

[Rails] Re: What's the best way to protect images from the public?

2009-07-03 Thread Gavin
> option because I'll might have loads of images to render per page. ^ apologies for the crap grammar - writing in a hurry today --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post t

[Rails] Re: What's the best way to protect images from the public?

2009-07-03 Thread Gavin
Alrighty... Was not aware of that. I think in this case it's best to go with the encrpted filename option because I'll might have loads of images to render per page. Thanks for your help guys. Gavin On Jul 3, 3:40 pm, Nicholas Henry wrote: > You can send a file inline without streaming for a

[Rails] Re: What's the best way to protect images from the public?

2009-07-03 Thread Nicholas Henry
You can send a file inline without streaming for an image (I'm using this in an application): send_file path, :type => 'image/jpeg', :disposition => 'inline', :stream => false HTH, Nicholas On Jul 3, 10:33 am, Gavin wrote: > > Why not?  It sounds like exactly what you want -- a way to send an

[Rails] Re: What's the best way to protect images from the public?

2009-07-03 Thread Gavin
> Why not? It sounds like exactly what you want -- a way to send an > arbitrary file that isn't in the public directory. Isn't send_file for streaming the file to the user though? I'm only looking to load the image on screen, I don't want the users to actually download a copy of the file. Thank

[Rails] Re: What's the best way to protect images from the public?

2009-07-03 Thread Marnen Laibow-Koser
Gavin Morrice wrote: [...] > send_file isn't appropriate here ( as far as I'm aware ). Why not? It sounds like exactly what you want -- a way to send an arbitrary file that isn't in the public directory. > > Suppose my profile image is located at "images/3.jpg". I want to > prevent users from

[Rails] Re: What's the best way to protect images from the public?

2009-07-03 Thread Gavin
Sorry, by "still allow access" I simply meant that I could still refer to the images in my HTML. ( ) send_file isn't appropriate here ( as far as I'm aware ). Suppose my profile image is located at "images/3.jpg". I want to prevent users from then visiting "images/4.jpg" and checking out pictu

[Rails] Re: What's the best way to protect images from the public?

2009-07-03 Thread Andrew Timberlake
On Fri, Jul 3, 2009 at 12:40 PM, Gavin wrote: > > Hey all! > > Im building an app at the moment in which users can upload images of > themselves. > > The problem is, because these images are stored in the public > directory they are open to the public. > > How can I protect these images but still