nanoPhotosProvider2 nanogallery2





Publish your self-hosted photos simply and automatically to nanogallery2.





PHP application for publishing your photos from your web server.









Blurred image preview during thumbnail download.

















Support all nanogallery2 base layouts and their variants.





grid layout

fixed width and height

justified layout

fixed height, variable width

cascading layout

fixed width, variable height












Automatic generation of responsive thumbnails

















Supports photo albums.
Easy to install and maintain - no database, only flat files.

Add-on for nanogallery2 nanogallery2.


















latest release: nanoPhotosProvider2 v1.1.0 -

Get new release alerts by following @nanostudio_org     follow @nanostudio_org




nanoPhotosProvider2 usage





Step 1: installation

On your webserver:
- create a folder named nano_photos_provider2
- in this folder:
  • copy the files:
    • nano_photos_provider2.php
    • nano_photos_provider2.json.class.php
    • nano_photos_provider2.cfg
    • nano_photos_provider2.encoding.php
  • create a folder named nano_photos_content
    • copy your photos there
    • you can organize your photos in folders (= albums)



Step 2: configure your HTML page

  • The page can be located anywhere on your webserver.
  • Install and configure nanogallery2 (see http://nanogallery2.nanostudio.org)
  • Configure the call to the plugin:
    • Use the specific parameters: kind and dataProvider
    • kind: set value to 'nano_photos_provider2'
    • dataProvider: URL to the nano_photos_provider2.php file installed in step 1
Example:


            jQuery(document).ready(function () {
              jQuery("#my_nanogallery").nanogallery2({
                thumbnailWidth:   'auto',
                thumbnailHeight:  150,
                kind:             'nano_photos_provider2',
                dataProvider:     'http://mywebsever.com/mypath/nano_photos_provider2/nano_photos_provider2.php',
                locationHash:     false
              });
            });
            



Step 3: test your page to see the result







Settings and configuration







Content management
You can add images and folders, or rename them, in your content folder.
Please note that the generated thumbnails are never purged, so you may delete the _thumbnails folders to force a new generation.


Title, description, tags
- Title
File names and folder names are used as title in nanogallery2.
The special caracter underscore '_' will be replaced by a white space.

- Description
A description can be defined in the file names or in the folder names.
Use '$$' to separate title and description. Example: 'Berlin$$Brandenburger_Gate.jpg'

- Metadata files
One metadata file can be optionally defined to store additional photo information.
It's an alternative solution for defining title and description.
Tags/keywords are defined in this file.

The metadate file has the same name as the image, with the extension '.txt'.
File content syntax:

        title= this is my title
        description= this is my descritption
        tags=tag1 tag2 tag3
        


- Album covers
By default, the first image found in a folder will be used for the album cover image.
The cover image can be specified by adding a leading @@@@@ to the filename of the image to be used.


- IDs
Please note that filenames and folder names are used as IDs. So if you rename an image or folder, previous used links to the renamed element will no longer work.


- Supported image formats
JPEG, GIF and PNG.


- Custom configuration
Custom settings are defined in nano_photos_provider2.cfg



section option default value description
config
fileExtensions "jpg|jpeg|png|gif" Supported file extensions (separtor is |)
contentFolder "nano_photos_content" Folder where albums and images are stored
sortOrder "asc" Filename sort order (asc or desc)
titleDescSeparator "$$" Separator between title and description in the filename or foldername
albumCoverDetector "@@@@@" Leading sequence in the filename of the image to be used as an album cover
ignoreDetector "_hidden" Ignore photos/albums (folders) containing this sequence in their name
images
maxSize* 1900 max. width/height of the displayed images
jpegQuality* 85 JPEG quality of the images
thumbnails
jpegQuality* 85 JPEG quality for the thumbnails
blurredImageQuality* 3 Quality of the blurred images (higher is better but slower)
allowedSizeValues "" List of allowed values for thumbnail image sizes (separtor is |)
Values should be the same as in your nanogallery2 settings.
Example: allowedSizeValues = "100|150|300|auto"
security
allowOrigins "*" List of allowed domain (CORS)
Example: allowOrigins = "http://nanogallery2.nanostudio.org"
memory
unlimited false Set to true to disable PHP memory management. May be useful for large images.
Use with caution!
*: after changing any of these values, please delete all _thumbnails folders to refresh the cached data.











Requirements




nanogallery2 >= v1.4
Webserver
PHP > v5.2 with GD-Library enabled





Tips and tricks




- Usage on a LOCAL WEB SERVER
Due to browser security features, dataProvider can not point to localhost, 127.0.0.1 or similar.
Possible workaround:
  • configure your server to allow CORS (see https://enable-cors.org/server.html),
  • or install a browser extension to disable CORS checking.


- Perfomances
Lowres images, thumbnails and blurred images are generated on first request and then cached on disk.
On first use, or after adding a large amount of new images, you may encounter delays and timeouts -> reload the page until you don't get any error. Generated data will then be cached, for faster access.


- SECURITY
Generation of thumbnails could be missused to satured the server disk space.
It's highly recommanded to limit accepted values for thumbnail sizes in the nano_photos_provider2.cfg configuration file.


- Limitations
The nanogallery2 option locationHash should NOT be enabled if albums have more than 2 levels.

Licensing





nanoPhotosProvider2 is open source and licensed under GPLv3 license.

Support

Need help using nanoPhotosProvider2?



Start by reading the documentation .
Questions, issues and bugs should be reported on Github.