# NanoGal ## Presentation NanoGal is fork of [MinigalNano](https://github.com/sebsauvage/MinigalNano) and MinigalNano is based on [Thomas Rybak's](http://www.minigal.dk/minigal-nano.html). Why fork ? Because I love understand and adapte application for my usage. NanoGal is a very simple image gallery. It adheres to the KISS principle and is very easy to install. NanoGal does not have a web admin interface: You just upload your images in the photo folder on your server (using FTP, SFTP...). It only requires php and GD (no database, no special libraries like PEAR or ImageMagick). NanoGal uses a javascript [gLightBox](https://github.com/biati-digital/glightbox), but it degrades gracefully if javascript is disabled. ## Features - Very simple media gallery - Use cache for increase speed - Thumb are gen and cache (WEBP) - Can read Exif - Use the organization of your file hierarchy - You can add text for gallery (dir) or/and for file (use Markdown format) - Support for PNG, GIF, JPEG, WEBP, BMP image formats - Support for OGV, MP4, WEBM video - Javascript lightbox, degrades gracefull if JavaScript is disabled - Can be customize with CSS (over charge actual theme) or create your theme ## Installation ### Docker For the moment I don't provide any image in any hub. #### Build image Image use ```shell wget https://forge.leslibres.org/Knah-Tsaeb/NanoGal/raw/branch/main/Dockerfile docker buildx build --no-cache -t nanogal:0.2.0 . ``` #### Start container You can use native docker volume. ```shell docker run -v nanogal_datas:/var/www/datas:ro -v nanogal_photos:/var/www/public/photos:ro -e TZ=UTC -p 8187:80 --name nanogal nanogal:0.2.0 ``` Or use absolute path ```shell docker run -v /opt/nanogal/datas:/var/www/datas:ro -v /opt/nanogal/photos:/var/www/public/photos:ro -e TZ=UTC -p 8187:80 --name nanogal nanogal:0.2.0 ``` ### Classic way - Requires `php` (8 or higher) and two extension `php-gd` and `php-mbstring`. - Place all the files in a directory on your server. - Configure your web server to serve `public/` directory. - Upload your photos to the `photos/` subdirectory. - That's all. ## Usage ### WARNING When you upload your file, some data are share, particularly [Exif data](https://en.wikipedia.org/wiki/Exif). Exif data can expose the GPS coordinates of where the photos/videos were taken. This may not be what you want. If you want, you can delete this data. Under GNU/Linux you can install `exiftool`. In the `bin` directory you have bash script (`remove_gps_datas.sh`) for remove this data in all file present in your gallery. USE AT OUR RISK. ### Adding your photos - Simply add your photos to the `photos` directory via FTP or SFTP or use sync app (look idea section). - You can create any subdirectories as you want. ### Adding a comment to a gallery - Create `note.md`. - Write content in Markdown. - Upload in the gallery's folder. ### Adding a comment to an image - Create an md file. Filename must be the image filename plus `.md`. (eg. `myimage.jpg` → `myimage.jpg.md`) - Write content in Markdown. - Upload in the gallery's folder. ### Using a custom image for folders - Create `folder.jpg` inside a folder: This image will be used as default image for folder. ### Thumbnails You do not have to care about thumbnails: They are automatically created in the `cache/thumbs` directory. If some thumbnails are wrong, you can purge this directory: Thumbnails will be automatically re-created. ## Options - Create `datas/config.php`. - Paste this code. ```php 'board', // Template filename (must be placed in 'public/templates' folder) 'title' => 'NanoGal', // Text to be displayed in browser titlebar 'description' => 'My gallery', // Use in meta tag "description" 'author' => 'NanoGal', // Your name 'skipObjects' => ['comment.html', '.gitkeep', 'aFolder', 'aFile.ext'], //Those files and folders will not be displayed 'imageCaptionPosition' => 'right', // Position of caption in lightbox 'sortBy' => 'name', // Sort by name or date 'orderBy' => 'desc', // Order by asc or desc 'thumbSize' => 250, // Thumbnail height/width (square thumbs) 'displayExifInfo' => false, // Display Exif info in caption 'disableCache' => false, // Enable or disable cache 'showShareLink' => false, // Show link for thumb, full, markdown link (thumb + link to full) 'nbItemsAtom' => 25 // Number of item in atom feed ]; ``` | Option | Type | Default | Description | | --- | --- | --- | --- | | templateFile | string | board | Template filename (must be placed in 'public/templates' folder) | | title | string | NanoGal | Text to be displayed in browser titlebar | | description | string | My gallery | Use in meta tag "description" | | author | string | NanoGal | Your name | | skipObjects | array | ['comment.html', '.gitkeep', 'aFolder', 'aFile.ext'] | Those files and folders will not be displayed | | imageCaptionPosition | string | right | Position of caption in lightbox `top` or `right` or `bottom` or `left` | | sortBy | string | name | Sort by `name` or `date` | | orderBy | string | desc | Order by `asc` or `desc` | | thumbSize | int | 250 | Thumbnail height/width (square thumbs) | | displayExifInfo | bool | false | Display Exif info in caption | | disableCache | bool | false | Enable or disable cache | | showShareLink | boll | false | Show share link for thumb, full, markdown link (thumb + link to full) | | nbItemsAtom | int | 25 | Number of item in atom feed #### Notes If you change the thumbsize, thumbnails are not re-create. If the difference between older and newer size are small, I think you don't need regen all thumb. But if you prefer, you can delete `cache/thumbs/*` for force re-create thumbnails. If you change any parameter, the cache file (html file and atom file) are delete and recreate. ## Ideas Original Idea by [SebSauvage](https://sebsauvage.net/wiki/doku.php?id=minigal_nano#gerer_votre_gallerie_avec_nextcloud) in french. If you have NextCloud installed on your server, you can use it to manage your NanoGal gallery. It's very convenient for uploading images, renaming them, moving them, and organizing them into folders. In the NextCloud settings: Settings > Administration > External Storage: | Option | Description | | --- | --- | | Folder Name | The name of the folder as it will appear in NextCloud. | | External Storage | Choose Local | | Authentication | None | | Configuration | Enter the path where your images are stored (the path to the NanoGal /photos directory) | Don't forget to disable encrypt for this folder. More info about external storage in [Nextcloud admin documentation](https://docs.nextcloud.com/server/stable/admin_manual/configuration_files/external_storage_configuration_gui.html). The same idea can be use with another sync tool of course. ------------------------------------------------------------ ## License NanoGal is licensed under the GNU AFFERO GENERAL PUBLIC LICENSE v3 (https://gnu.org/licenses/agpl-3.0.txt). Icons : - Author: [Vectopus](https://github.com/Vectopus/Atlas-icons-font?ref=svgrepo.com) - License: [MIT License](https://github.com/Vectopus/Atlas-icons-font/blob/main/LICENSE) - Collection: [Atlas Variety Line Icons](https://www.svgrepo.com/collection/atlas-variety-line-icons/) Origin - [MinigalNano by SebSauvage](https://github.com/sebsauvage/MinigalNano) - [Project contributors](https://github.com/sebsauvage/MinigalNano/blob/master/AUTHORS) - [Original discussion page (english)](http://sebsauvage.net/wiki/doku.php?id=minigal_nano_en) - [Original discussion page (french)](http://sebsauvage.net/wiki/doku.php?id=minigal_nano)