[LRUG] Photo gallery with access control

Andrew Stewart boss at airbladesoftware.com
Fri Apr 25 03:05:24 PDT 2008


On 25 Apr 2008, at 10:53, Neil Chandler wrote:

> I'm trying to develop a photo gallery with access control, similar  
> to facebook albums where you can choose who (friends, groups,  
> everyone etc) can view the images you upload. I'm currently using  
> attachment_fu for the file uploads but was wondering the best way  
> to add the access control or if attachment_fu is the best solution.

For uploading files, attachment_fu works well though it can be a  
little hard to figure out the code.  It's being re-written here:

http://github.com/technoweenie/attachment_fu/tree/master

Paperclip is worth considering too:

http://github.com/thoughtbot/paperclip/tree/master

> I've been searching google and found plenty of results for setting  
> up and using attachment_fu but none of them seem to cover  
> permission. One article did show how to use :db_file to store and  
> retrieve the images from the DB but from what I've read I'm not  
> sure using the DB is the best solution.


I would leave attachment_fu to upload files, and handle authorisation  
elsewhere.

You could save the images on the file system in a directory  
unavailable to the public, i.e. not in your app's public/images.   
Then you simply have a controller whose index and show actions send  
the appropriate file(s) to the browser, if the user is permitted to  
see that file(s).

Hope that helps.

Regards,
Andy Stewart

-------
AirBlade Software
http://airbladesoftware.com







More information about the Chat mailing list