how to set permissions to original imagefield uploaded files?
I have served my images by imagecache and I don't want to allow anonymous and even some roles of authenticated users to open original images directly.
For example when I have a 'gallery1' (1) directory in 'sites/all/files' where original images are uploaded by imagefield (through filefield_paths module) then I have also 'imagecache/preset_name/gallery1' (2) directory where are images created by imagefield.
Now I want to block access to images from directory (1) while allow access to images from directory (2) to some roles. Of course imagecache should have access to create derivates form original images.
How can I do that?
I don't know if I can done this with 'private files' setting - when I turn it on my images don't show in nodes with imagefield.
Comments
Comment #1
sgriffin commentedsubscribing
Comment #2
quicksketchI should note that ImageCache's settings only work if you have Private Files enabled, otherwise they don't do anything. ImageField grants access to images based on a user's node access permission, so if the user can view the node, they can view the image. I personally HATE the private files system. You should never use it, it will cause your site to become at LEAST 3-5 times slower. Take a look at the approach suggested in http://drupal.org/node/540754, and just restrict access to certain directories.
Comment #3
sgriffin commentedNuts. I guess I'll convert to public and build out a special .htaccess
Well at least I can consolidate css/js eventually.
Comment #4
sgriffin commentedWill do..
Comment #5
marcoka commented-> ImageField grants access to images based on a user's node access permission, so if the user can view the node, they can view the image.
So its not possible to restrict the access to the ORIGINAL file? so to use private file is useless?
Comment #6
sgriffin commentedCorrect, the only way to restrict access is ironically with a public file system and a configured .htaccess file.
Converting file systems isn't impossible, you only need to do a search and replace sql command on the filepath.
There should be some built in drupal method to do this automatically.
Comment #7
marcoka commentedi restricted the access with a .htaccess to the folder where filefiled/imagefield saves its files, used the Patches for Imagecache postet by "EugenMayer" and wrote an imagecache protection module based on these patches. Now i can protect certain presets.
Comment #8
marcoka commented