if the download method is set do privat album photos will not find the images.
new files are storen at the right place but thumbnail an images can not be desplayed .
the path is: http://localhost/../filestore/photos/t_108_0859_r2.jpg
but should be something like: http://localhost/system/files/photos/t_108_0859_r2.jpg

CommentFileSizeAuthor
photos.jpg7.41 KBstoltoguzzi
download.jpg27.52 KBstoltoguzzi

Comments

stoltoguzzi’s picture

I made some tests, then I modified the following function:

function _photos_file_create_url($path) {
  if (strpos($path, file_directory_path() .'/') === 0) {
    $path = trim(substr($path, strlen(file_directory_path())), '\\/');
  }
   /* return $GLOBALS['base_url'] .'/'. file_directory_path() .'/'. str_replace('\\', '/', $path); */
  return file_create_url($path); </strong>
}

so file_create_url takes care about privat or public
this way it looks like ok? Could you check that?

eastcn’s picture

It should not be checked, as will appear wrong.
In addition, photos.module will use an independent privacy controls.
thanks

stoltoguzzi’s picture

I think there is a missanderstanding, your modul can protect if a user can see a photo or not.
but if a user knows the url to this photo he can bypass your protection an download a photo using regular http request.
using private mode the files can be placed outside of the root-path an can only be downloaded using drupal.
and because this setting for private or global is set per side I think all modules should take care otherwise they can not be installed on installation using private mode.

here is a good description
http://11heavens.com/files-in-Drupal

your module is genial, I would like to use it but I need the private download for other reason and this setting is global:-(

eastcn’s picture

Is not the case, you can try photos.module the privacy controls: http://drupal.org/node/310151
Test, it unstable.
thanks

stoltoguzzi’s picture

I made a test:
- file system is set to public
- I am loged in as admin in IE
- I create some albums
- create a new user
- log in as this new user in firefox
- this has now access at all to any photos in the permission settings
- he can not see anything about albums that is ok
- know a copy an url from the admin IE to the new user in firefox an can see the photos without any problem
- if the files setting are set to privat this is not possible if the files-store is somewhere outside of the web-root.

Many drupal-sides will be switched to private download for this and other reason and because this is a system configuration your modul should support it.

eastcn’s picture

Perhaps you do not fully tested, photos_access can completely control the access images, the user will not know the image storage location.

1) the use of photos_access, users will never see images in the server's actual location.

You can test here, http://drupal.500959.com/photos/image/10, view the Password: 1234

When not authorized, you can not view images, only to see an image of the designated error.

2) Album will not support the private system settings.

3) System is set to private, through the url still be able to download the document.

stoltoguzzi’s picture

Status: Active » Closed (fixed)

"Album will not support the private system settings."

as I wrote sometimes there is a need to switch on this private settings for other reason/modules, an if this is switched on Album can not be used!
But I have my solution, thank you.

kassissieh’s picture

The change stoltoguzzi recommended worked for me, though the original code has changed slightly.

function _photos_l($path) {
  /*return $GLOBALS['base_url'] . '/'. trim($path);*/
  return file_create_url($path);
}

I agree that this is necessary for sites that require the file system set to "private download method" and want this module to work. The reason is to protect the other files in the site -- it's not about the privacy of the photo files.

roball’s picture

Title: Download method privat does not work » Download method private does not work

I would suggest to forget the private download method at all and switch back to public. Then disable core's "Upload" module and use the "WebFM" module instead.