Kris-B / nanoGALLERY

image gallery simplified - jQuery plugin. Touch enabled, responsive, justified/cascading/grid layout and it supports pulling in Flickr, Google Photos and self hosted images.
https://nanogallery2.nanostudio.org/
439 stars 101 forks source link

Question: How can I add pictures to the image library dynamically? #50

Closed jheinitz closed 9 years ago

jheinitz commented 9 years ago

Hello Kris!

Great work! Thanks for putting your efforts in here.

I just started to expore the features of nanoGALLERY. I have a directory on my webserver and would like to fill the nanoGALLERY image library dynamically from the content of the directory. i can also imaging to have one directory containing the images and a second directory with the thumbnails.

Is there a way to achieve this?

Best regards

Jens

Kris-B commented 9 years ago

Hi Jens! I'm working on this feature but there's no release date yet...

Kris-B commented 9 years ago

Hallo Jens, I'm looking for beta testers for this feature: interested?

jheinitz commented 9 years ago

Sure! Absolutely. Thanks for considering me.

Jens

Gesendet von meinem Smartphone ...

Am 12. November 2014 23:11:02 schrieb Christophe Brisbois notifications@github.com:

Hallo Jens, I'm looking for beta testers for this feature: interested?


Reply to this email directly or view it on GitHub: https://github.com/Kris-B/nanoGALLERY/issues/50#issuecomment-62804387

Kris-B commented 9 years ago

Ok, a very first beta is available: https://github.com/Kris-B/nanoGALLERY_JSON

A demo is included in the release. Please use the nanogallery plugin included. Not the v5.2.2

Feedback can be done directly in this new github repo.

Thx

jheinitz commented 9 years ago

Hi Christophe,

I managed to download the beta version of nanoGALLERY_JSON v0.1.0 recently. I also managed to use my own pictures. It took me a while.

Currently it seems that the directory "ngcontent" needs to reside in the same directory where the PHP script is located. There is one line in the code which says:

$data->fullDir= DIR.'/ngcontent'.($album);

In another line DIR is used to locate the cfg file. That's why I assume that this is the base directory of the PHP.

I pointed the itemBaseURL to a different location, but it seems to be in line with the customSourceProvider definition.

Overall I find this very useful. Especially the possibility to use different levels of directories.

What makes it a little bit difficult is the fact that all pictures need to reside in directories call _images/ and the thumbs in _thumbnails/. Wouldn't it be better to have the files directly in a directory structure that one would have on a disk or server?

Before you provided this beta version, I created a UNIX shell script to create my HTML file including the galleryContent definition by parsing the directory structure. I choosed to have the thumbnails named pic_t.jpg if the image is pic.jpg and they can be located in the same directory or in a different one. Using a different one (would be ngcontent_t) in your example would leave the source directory completely unchanged. For the Album Art file, I used a file called AlbumArt.jpg and AlbumArt_t.jpg if it exists in the directory.

Last but not least, I saw that you named your images with characters like ä or é. I can see these pictures. I figured out that all filenames need to be in UTF-8 encoding. So, I need to consider to change my ISO-8859 encoding. Would it be possible to specify the encoding somewhere?

I hope that you find my feedback useful.

Best regards

Jens

2014-11-13 23:54 GMT+01:00 Christophe Brisbois notifications@github.com:

Ok, a very first beta is available: https://github.com/Kris-B/nanoGALLERY_JSON

A demo is included in the release. Please use the nanogallery plugin included. Not the v5.2.2

Feedback can be done directly in this new github repo.

Thx

— Reply to this email directly or view it on GitHub https://github.com/Kris-B/nanoGALLERY/issues/50#issuecomment-62981776.

Kris-B commented 9 years ago

Hi Jens, Thanks for your feedback!

Using dedicated folders for images and thumbnails allows to export the same images from your photo management software with different settings (resolutions). Moreover nanogallery is responsive and adaptive: the plugin supports 5 different sizes for thumbnails (and will also support 5 different sizes for images in a near future). That means up to 10 files per image. It seems easier for me to manage all these files in separate folders.

For special characters like ä or é, I didn't do any thing special. I'm using Windows and a put these characters directly in the filenames. No special settings. The php script will encode these characters in the JSON file, which is then decoded by the javascript. I don't think that you have to care about encoding with your filenames.

More customizing possibilities are coming...

jheinitz commented 9 years ago

Hi Christophe,

I'm a little bit confused. When I use the standard nanoGALLERY plugin, I'm unable to display images that contain äöü in their names. Atleast when the files are stored in ISO-8859-1. I'm using an Apache2 webserver on Linux.

However, when I use the new nanoGALLERY_JSON plugin, I'm able to see my images with the äöü characters in ISO-8859-1 format. I do NOT see pictures where the filenames have äöü in UTF-8 charset.

You say that you are using the pligin directly on a PC. What webserver are you using. Could it be that there is something different?

Regarding the different sirectory structure, I got your point.

Best regards

Jens

2014-11-16 22:28 GMT+01:00 Christophe Brisbois notifications@github.com:

Hi Jens, Thanks for your feedback!

Using dedicated folders for images and thumbnails allows to export the same images from your photo management software with different settings (resolutions). Moreover nanogallery is responsive and adaptive: the plugin supports 5 different sizes for thumbnails (and will also support 5 different sizes for images in a near future). That means up to 10 files per image. It seems easier for me to manage all these files in separate folders.

For special characters like ä or é, I didn't do any thing special. I'm using Windows and a put these characters directly in the filenames. No special settings. The php script will encode these characters in the JSON file, which is then decoded by the javascript. I don't think that you have to care about encoding with your filenames.

More customizing possibilities are coming...

— Reply to this email directly or view it on GitHub https://github.com/Kris-B/nanoGALLERY/issues/50#issuecomment-63240342.

Kris-B commented 9 years ago

Hi Jens,

Actually, I'm generating my images on Windows, then I copy them to my provider with Filezila. I think my provider is running Apache on Linux.

Question: how do you set the charset of filenames? Thanks

Christophe

jheinitz commented 9 years ago

Hi!

Actually I'm not setting the charset itself. I run samba on my Linux box and I have configured the "unix charset" variable to iso-8859-15. So when I mount an smb share to my PC and copy the files from Windows, the Unix filenames are in iso-8869-15 encoded. When I connect to the server using Putty, I can configure the translation to be ISO-8859-15 or UTF-8. Depending on these setting my filenames are encoded accordingly when I copy an existent file to a test file containing äöü.

I hope that you can follow ... :-)

Best Regards Jens

Gesendet von meinem Smartphone ...

Am 17. November 2014 22:52:33 schrieb Christophe Brisbois notifications@github.com:

Hi Jens,

Actually, I'm generating my images on Windows, then I copy them to my provider with Filezila. I think my provider is running Apache on Linux.

Question: how do you set the charset of filenames? Thanks

Christophe


Reply to this email directly or view it on GitHub: https://github.com/Kris-B/nanoGALLERY/issues/50#issuecomment-63382841

jheinitz commented 9 years ago

Hello Christophe!

I made some more tests with the latest galleryJSON-master.zip distribution because I swa that you modified some of the files. Especially I saw that you played with the encoding and implemented some CustomEncode function.

However, using your php file, I had issues to display my images containing äöü. I changed it in some places and now it works fine for me. As said before, I'm running apache2 on Ubuntu Linux and display the images through Chrome on Windows 7. Please find below the differences between my galleryJSON.php and yours:

It seems that the parameter in the config file (isUTF8Encoded) only needs to be taken into account sometimes, but not always. Maybe it helps you to make progress on this.

Thanks for this wonderful tool.

Best regards

Jens

diff -r beta2/galleryJSON.php beta3/galleryJSON.php 175,177c175,176 < $oneItem->src=rawurlencode(('ngcontent'.$album.'_images/'.$image)); < // $oneItem->src=CustomEncode(('ngcontent'.$album.'_images/'.$image)); < //

$oneItem->src=utf8_encode(('ngcontent'.$album.'_images/'.$image));

                //

$oneItem->src=rawurlencode(('ngcontent'.$album.'_images/'.$image));

$oneItem->src=CustomEncode(('ngcontent'.$album.'_images/'.$image)); 182,184c181,182 < $oneItem->srct=(rawurlencode('ngcontent'.$album.'_thumbnails/'.$image)); < // $oneItem->srct=(CustomEncode('ngcontent'.$album.'_thumbnails/'.$image)); < //

$oneItem->srct=(utf8_encode('ngcontent'.$album.'_thumbnails/'.$image));

                  //

$oneItem->srct=(rawurlencode('ngcontent'.$album.'_thumbnails/'.$image));

$oneItem->srct=(CustomEncode('ngcontent'.$album.'_thumbnails/'.$image)); 190,192c188,189 < $oneItem->srct=(rawurlencode('ngcontent'.$album.'_thumbnails/'.$GLOBALS['albumThumbnailDetector'].$image)); < // $oneItem->srct=(CustomEncode('ngcontent'.$album.'_thumbnails/'.$GLOBALS['albumThumbnailDetector'].$image)); < //

$oneItem->srct=(utf8_encode('ngcontent'.$album.'_thumbnails/'.$GLOBALS['albumThumbnailDetector'].$image));

                    //

$oneItem->srct=(rawurlencode('ngcontent'.$album.'_thumbnails/'.$GLOBALS['albumThumbnailDetector'].$image));

$oneItem->srct=(CustomEncode('ngcontent'.$album.'_thumbnails/'.$GLOBALS['albumThumbnailDetector'].$image)); 231,233c228 < // $oneItem->ID=CustomEncode($filename); < // $oneItem->ID=rawurlencode($filename);

< $oneItem->ID=utf8_encode($filename);

                $oneItem->ID=CustomEncode($filename);

237,239c232 < // $oneItem->ID=$albumID.CustomEncode('/'.$filename); < // $oneItem->ID=$albumID.rawurlencode('/'.$filename);

< $oneItem->ID=$albumID.utf8_encode('/'.$filename);

                $oneItem->ID=$albumID.CustomEncode('/'.$filename);

253,254c246 < // $oneItem->srct=CustomEncode(('/ngcontent/'.$t.'/'.$s));

< $oneItem->srct=rawurlencode(('/ngcontent/'.$t.'/'.$s));

              $oneItem->srct=CustomEncode(('/ngcontent/'.$t.'/'.$s));

307c299

< ?>

?> \ No newline at end of file

2014-11-17 22:52 GMT+01:00 Christophe Brisbois notifications@github.com:

Hi Jens,

Actually, I'm generating my images on Windows, then I copy them to my provider with Filezila. I think my provider is running Apache on Linux.

Question: how do you set the charset of filenames? Thanks

Christophe

— Reply to this email directly or view it on GitHub https://github.com/Kris-B/nanoGALLERY/issues/50#issuecomment-63382841.

Kris-B commented 9 years ago

Hi Jens! I didn't had many time in last weeks... But thanks to your informations I think I have some new ideas. I need to check them (but I also need to find some time). Thanks for your patience!

Kris-B commented 9 years ago

Hi Jens, sorry for this late reply...

I made a new version of the PHP application. You can find it now at: https://github.com/Kris-B/nanoPhotosProvider The data structure is now simpler and the thumbnails are generated automatically.

To test it, you'll have to use the jquery.nanogallery.js version from the demonstration folder.

Kris-B commented 9 years ago

This feature is now provided by https://github.com/Kris-B/nanoPhotosProvider

thx.