PhotoShow icon indicating copy to clipboard operation
PhotoShow copied to clipboard

Using symlinks for images does not work

Open lauhub opened this issue 7 years ago • 1 comments

Context

I have a folder which receives all my photos from an external source: /rootdir/photos. This folder contains all photos without any organization. As it is a synchronization folder, it is not possible to re-organize the photos directly inside it with subfolders.

I need to organize photos by months: all photos taken in october will be put in (e.g.) a 2016-10 folder.

I don't want to duplicate my photos (I got several tens of GB of them) so the nice to do this with Linux is to use symbolic links (symlinks).

So I create a /rootdir/photosbymonths/2016-10 folder and create a link from this folder to the image in /rootdir/photos. Here is an example of what I can see in my rootdir/photosbymonths/2016-10 folder:

-rw-r--r-- 1 user group 3898730 Jan 18 22:12 IMG_0222.JPG
lrwxrwxrwx 1 user group      25 Jan 18 22:16 IMG_1728.JPG -> ../../photos/IMG_1728.JPG

I use Debian Wheezy with an NGINX and PHP-FPM server.

The problem

As soon as I create the symlink, I got the following error when I browse my site:

This file is not inside the photos folder !

This exception is raised from line 183 of my src/classes/File.php file.

If I remove the symlink, the error disappears.

Question

Is there a way to use symlinks for this kind of use case ? Is there a configuration item to modify ?

lauhub avatar Jan 18 '17 21:01 lauhub

I submitted a PR that would allow you to do that, by enabling it in your config.php with

$config->allow_symlinks_outside_photos_dir = true;

Once it is accepted and merged, you can update to the latest code to get the needed changes to allow this. Or, you can look at the changes I made in my commit, and make the same changes in your PhotoShow files.

gboudreau avatar Jan 19 '17 00:01 gboudreau