nanostudio-org / nano_photos_provider2

PHP photos provider for nanogallery2
https://nanophotosprovider2.nanostudio.org/
47 stars 12 forks source link

Cannot handle folders (= albums) on certain platforms #20

Open EthanEsrah opened 5 years ago

EthanEsrah commented 5 years ago

Hi, Just started a gallery project using nanoGallery2 and nanoPhotosProvider2. Noticed that the display of albums did not work for me, only displaying the contents of a single album. After some debugging, I've found the reason: In line 111 of nano_photos_provider2.json.class.php, the following statement is used to read all picture files of a folder: $files = glob($this->data->fullDir . $filename."/*.{".str_replace("|",",",$this->config['fileExtensions'])."}", GLOB_BRACE); In my setup, this never returned any file names although there were plenty of files in the folder. The problem is the use of flag GLOB_BRACE. On certain platforms, this flag is not supported and GLOB will not return any file names. This is also described in the PHP documentation. I'm working on a hosted server (STRATO, a German provider) that seems to use such platforms. As a quick workaround, I adjusted line 111 in the following way: $files = glob($this->data->fullDir . $filename . "/*.jpg"); This only works for *.jpg picture files but since I don't use any others anyway it is OK for me. However, would be nice to have a solution in the official coding for the GLOB_BRACE problem. Apart from that: Great application! Best regards, Sven