Single File PHP Gallery 4.11.0 (SFPG) See END USER LICENSE AGREEMENT for commercial Released: 6-october-2022 https://sye.dk/sfpg/ By Kenny Svalgaard ____________________________________________________________ WHAT IS IN THIS FILE * WHAT IS IN THIS FILE * WHAT IS SINGLE FILE PHP GALLERY? * END USER LICENSE AGREEMENT / EULA * FEATURES * IMPORTANT INFORMATION * NEWS IN THIS VERSION * REQUIREMENTS * HOW TO USE / QUICK START * USING A WRAPPER FILE * TIPS / FAQ * KNOWN ISSUES * SUPPORT / REQUESTS / HELP / CONTACT * CONFIGURATION INFORMATION ____________________________________________________________ WHAT IS SINGLE FILE PHP GALLERY? Single File PHP Gallery is a web gallery in one single file. All you have to do is copy the script to any directory containing images to make a gallery. Sub directories will be sub galleries. Thumbnails for images and directories are generated automatically. Descriptions for galleries and images can be added by making a simple text file. Single File PHP Gallery does not require any configuration or programming skills to use. You can see how it looks in the demo here: https://sye.dk/sfpg/ ____________________________________________________________ END USER LICENSE AGREEMENT / EULA For private non commercial use Single File PHP Gallery can be used for free. When used commercially a donation for at least 10$ must be made per domain where it is used. You are of course still more than welcome to donate if you like the gallery, even though you only use it privately. Under no circumstances can Single File PHP Gallery or any part of it be distributed or sold, or be part of another work that is being distributed or sold. Making a donation: Domain name must be clearly stated in the donation, otherwise the donation will not grant use of the script under donating conditions. Donations are not refundable. Use the PayPal donate button on the page for donations: https://sye.dk/sfpg/ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ____________________________________________________________ FEATURES * Gallery in one single file * Free for private non commercial use * Very simple Plug'n'Play like ease of use * Uses no Database * Automatically creates thumbnails * GPS link and map for images with GPS information * Zip option for download of gallery images and files * Slideshow option * PayPal integration for simple selling * Displays EXIF, IPTC and PNG text chunks information * Option to password protect gallery * Administrator options to upload, rename, move, delete and create directories, images and files * Administrator options to manage description and selling information * Rotates images using EXIF information * 3D MPO red/cyan anaglyph and stereo image generation * Keyboard navigation * Option to add watermark to all images in gallery * Supports JPG, JPEG, PNG and GIF * Unlimited numbers of sub galleries * See configuration information for all features ____________________________________________________________ IMPORTANT INFORMATION * Make sure to NOT place any content from untrusted sources in the gallery. Code or scripts embedded in files could be sent to the end users, and could be executed. * The gallery contains an Admin option, which allow users to upload, delete, move, rename and create directories, images and files in the gallery. If using this option, make sure that only administrators have access to the gallery. Do not put the gallery unprotected on a public web server with this option enabled. See the ADMIN option for details. For this to work, PHP needs permission to create, modify and delete in the GALLERY_ROOT. * The gallery contains an automatic clean-up function that deletes unused files in DATA_ROOT. The gallery will delete files in the DATA_ROOT that are no longer used by the gallery. So make sure not to use the DATA_ROOT for storing anything. The clean-up routine is activated when viewing a directory where the number of subdirectories, images and/or files have changed since last access to the directory. For this to work, PHP needs permission to delete in the DATA_ROOT. * The gallery contains options to delete images older than a set number of days, and empty directories. If using these options, make sure to have a backup of the GALLERY_ROOT. For these options to work, PHP needs permission to delete in the GALLERY_ROOT. ____________________________________________________________ NEWS IN THIS VERSION * Added option to extract and show PNG text chunks information. * Fixed handling of images with corrupt EXIF date information. News from previous version: * Added zip option to allow download of galleries as zip files. Zip option is disabled by default. See zip section for configuration options. * Added detection of inaccessible GALLERY_ROOT. Script will show an error message if GALLERY_ROOT is inaccessible. * Added TEXT_DAYS option, to allow setting localized representation of days. * Added TEXT_MONTHS option, to allow setting localized representation of months. * Other minor fixes, changes and enhancements. News from the version before previous version: * Enabled script to be fully configurable from a wrapper file. See new section "USING A WRAPPER FILE". * Moved SECURITY_PHRASE to a separate file in the DATA_ROOT. See the "SECURITY_PHRASE" description under the DATA_ROOT option. * Added functionality to allow download of files stored outside web root (when GALLERY_ROOT is set to an absolute path). * Added TEXT_INFO_LABEL option to allow setting different text on the information box and information button. TEXT_INFO_LABEL can be set to '' to remove the information box from the information panel. * Added administrator option to allow choosing an image to be used as thumbnail for the directory. * Enhanced the HTML_DESCRIPTIONS option to allow setting a list of allowed HTML tags. It can still also be set to TRUE for all or FALSE for none. * Enhanced the TEXT_EXIF_MAP and EXIF_MAP_LINK options. They can now both be set to '', to remove the map link in the EXIF information panel. * Enhanced the EXIF_MAP_EMBED_LINK option. It can now be set to '', to remove the imbedded map in the information panel. * Changed so that a space is added between each line in descriptions, when DESC_NL_TO_BR is FALSE. * Changed all $variables in the configuration part of the script to constants, to allow overriding all options from a wrapper. * Changed all configuration defines to use a new option function to not trigger warnings when already defined in a wrapper. * Fixed issue where non-empty directories would also be deleted from the gallery root if the DELETE_EMPTY_DIRS option is enabled. * Minimum PHP version 7.0 is required. * Other minor fixes, changes and enhancements. For changes in previous versions see here: https://sye.dk/sfpg/ ____________________________________________________________ REQUIREMENTS For this gallery to function you will need the following: * A web server capable of running PHP 7.0, or higher, scripts. * The PHP GD library (php_gd) installed. See here for information: https://www.php.net/manual/en/book.image.php * PHP write access to server. * PHP memory limit large enough to contain both full size image and thumbnail. See the FAQ section for further information on this. ____________________________________________________________ HOW TO USE / QUICK START The only thing you have to do is place a copy of the index.php file to any directory of your web. When this is done all images (jpg, jpeg, png, gif) and files if enabled, in that directory and all sub directories will be shown in the gallery. By default the script will try to create a directory called "_sfpg_data" in which thumbnails and information is saved. If PHP only have write access in a certain directory, change the DATA_ROOT to point there. ____________________________________________________________ USING A WRAPPER FILE You can create a wrapper script where you can define only the options you want to change, and include the Single File PHP Gallery script at the bottom. The wrapper script will then behave like Single File PHP Gallery. Using a wrapper file for sfpg is great: * If you want to have a compact view on your changed options. * If you want to preserve changed options when upgrading the sfpg script. * If you do not want to make changes in the sfpg script file. * If you want to keep the sfpg script read-only. * If you have multiple galleries - they can then share the same sfpg script. If you want the wrapper script named index.php, you have to either rename the sfpg script or move it to another place. You can even move the sfpg script outside DOCUMENT_ROOT. IMPORTANT: In a wrapper file you must use 'define()' instead of 'option()' (as the 'option' function is not yet declared). IMPORTANT: In a wrapper file the php tag "'.TEXT_GALLERY_NAME.''); define('GALLERY_ROOT', '/users/bob_the_user/wwwroot/images/my_pictures/'); define('DIR_EXCLUDE', ['_sfpg_data', '_sfpg_icons', 'private_images']); define('HTML_DESCRIPTIONS', '
');
@include '/srv/www/tools/sfpg_language_dk.php'; // include local language TEXTs if any
include '/srv/www/tools/sfpg.php';
?>
------ EXAMPLE WRAPPER SCRIPT ENDS ABOVE THIS LINE ------
____________________________________________________________
TIPS / FAQ
* If some or all thumbnails are missing or show up as a red X, the reason could be that the full images are too big for the php-engine to load them into memory. You will then have to do one of the following:
1. Make the full images smaller.
2. Increase the memory_limit in php.ini. (If the memory_limit is 8MB, it gives a maximum image size on about 1600*1600 pixels).
* If no thumbnails or images show, it could be that the script does not have the php tag " will of course still be effective when viewing the gallery.
____________________________________________________________
SUPPORT / REQUESTS / HELP / CONTACT
If you need help getting Single File PHP Gallery to work, then please start by running the SFPG TEST script file on the server. The SFPG TEST script is a normal PHP file, you can download it from the Single File PHP Gallery page. The script tests to see if the requirements for the script to run are met, and generates an output explaining what could be the issue. If the output from the script does not provide enough information for you to make the script work, then please use the contact form on the Single File PHP Gallery page. Describe the issue you are having and also copy/paste the information from the SFPG TEST script along with the description.
If you have comments, questions, requests, greetings etc. regarding Single File PHP Gallery, please use the contact form on my page.
https://sye.dk/
____________________________________________________________
CONFIGURATION INFORMATION
The script can be edited in a plain text editor. Open the index.php and you will find the configuration section at the top of the script.
Refer to the descriptions below for configuration.
____________________________________________________________
option('GALLERY_ROOT', './');
Set the path of the gallery root, where the images and sub directories containing images are placed.
The default value is './' which is the directory where the script is placed.
If GALLERY_ROOT is set to an absolute path and SHOW_FILES is set to TRUE, then a symbolic link called "_sfpg_download" will be created in script directory. This link gives web access to the GALLERY_ROOT, enabling download of files.
IMPORTANT: GALLERY_ROOT should always end with a slash like the examples below.
Example 1: './images/'
Example 2: $_SERVER['DOCUMENT_ROOT'].'/gallery/images/'
Example 3: '/users/bob_the_user/wwwroot/images/my_pictures/'
____________________________________________________________
option('DATA_ROOT', './_sfpg_data/');
Set the path to where thumbnails and other data should be saved. PHP needs to have write access to this directory. If PHP only have write access in a certain directory, change the DATA_ROOT to point there.
By default DATA_ROOT points to a directory called _sfpg_data in the same directory where the script is placed. If the directory do not exists, the script will try to create it. The _sfpg_data directory is by default excluded from the gallery, using the DIR_EXCLUDE option.
IMPORTANT: DATA_ROOT should always end with a slash like these examples:
Example 1: './thumbs/'
Example 2: $_SERVER['DOCUMENT_ROOT'].'/gallery/thumbs/'
Example 3: '/users/bob_the_user/data/sfpg_thumbs/'
SECURITY_PHRASE
One of the files created in the DATA_ROOT is a file called sp.php. It contains the definition of the SECURITY_PHRASE. The SECURITY_PHRASE is used to make the gallery URL's tamper resistant to avoid creative or malicious use.
Creation of the sp.php file and a random SECURITY_PHRASE is handled automatically by the script and you do normally not need to think about this.
You should however know that all links to the gallery containing the sfpg parameter uses this SECURITY_PHRASE. So if the sp.php file is deleted, all previous links to the gallery will end up in the root of the gallery.
Data stored in the DATA_ROOT also uses the SECURITY_PHRASE, so if the sp.php file is deleted or if the SECURITY_PHRASE is changed then all other contents of DATA_ROOT directory must be deleted.
If PHP do not have write access to any useable directory, or if you have a SECURITY_PHRASE from a previous version of the script that you want to use, then follow the 5-step guide below and create your own sp.php.
To create the sp.php file manually, do this:
1. Create the DATA_ROOT directory.
2. Create a file called "sp.php" in the DATA_ROOT directory.
3. Edit the sp.php file and copy this one line of code to the file:
4. Insert a random string of chars between the last two ''.
5. Save the file.
____________________________________________________________
option('PASSWORD', '');
Set the password that will give access to the gallery.
Set to '' to not password protect the gallery.
If set to anything but '', the gallery will be protected by password.
The gallery uses PHP sessions when logging in, which require the client to accept cookies. If the client do not accept cookies, the user will be prompted for password over and over again.
Entering a wrong password or not accepting cookies will simply display the login form again. No error is displayed.
IMPORTANT: Setting a password will only restrict access to images and files through the gallery. If someone knows or can guess the path to images or files, they will be able to access them without entering the password.
IMPORTANT: If GALLERY_ROOT is set to an absolute path and SHOW_FILES is set to TRUE, then a symbolic link called "_sfpg_download" will be created in script directory. This link gives web access to the GALLERY_ROOT, enabling download of files.
IMPORTANT: Know that images can, and most likely will, be cached by the browser. So make sure to only access the gallery when using a "Private Window", "Incognito", "InPrivate Browsing" or what ever your browser calls it when not logging and saving anything.
IMPORTANT: Know that unless you are using a HTTPS connection, the entire content of the gallery including the password when you login, text and images are sent unencrypted over the internet.
IMPORTANT: Remember that the password is stored in the gallery script in clear text, so anyone with access to the files on the server, can read it.
____________________________________________________________
option('ADMIN', FALSE);
** WARNING ** SETTING THIS OPTION TO ANYTHING OTHER THAN FALSE WILL ALLOW USERS TO UPLOAD, DELETE, RENAME, MOVE and CREATE DIRECTORIES, IMAGES AND FILES IN THE GALLERY_ROOT **
Set to FALSE to disable the administrator functions.
Set to TRUE to enable users to access the administrator menu.
When enable the following admin options are available:
1. Upload of files to the gallery.
2. Rename, move, and delete images and files.
3. Rename, move, delete and create directories.
4. Create, edit and remove descriptions for directories, images and files.
5. Create, edit and remove PayPal selling information for images.
6. Select custom image to be used as thumbnail for directories.
IMPORTANT: Do not put the gallery unprotected on a public server with this option enabled. (The PASSWORD option can be used to protect the gallery.)
IMPORTANT: Make sure that only administrators have access to the gallery, when this option is enabled (set to TRUE).
INFO: Using these options require PHP to have permission to create, edit and delete in the GALLERY_ROOT.
INFO: Uploading or Moving files to a directory that already contains files with the same name, will overwrite the files without confirmation.
INFO: Deleting a directory will also delete all files and sub directories inside the directory - Keep in mind that there could be files that are not shown in the gallery.
INFO: Deleting, moving or renaming a file will also, if they exists, delete, move or rename the thumbnail (defined by FILE_THUMB_EXT) and the description (defined by DESC_EXT) for the file.
INFO: Deleting, moving or renaming an image will also, if they exists, delete, move or rename the description file (defined by DESC_EXT) and the selling file (defined by PAYPAL_EXTENSION) for the image.
If you want to have a public gallery and also want to allow administrators to login and use the admin functions, the easiest would be to use a wrapper script for the admins. To make an admin wrapper script do this:
1. Configure the public gallery as you want. Leave the ADMIN option to FALSE, and the PASSWORD option to '', which will make it accessible for public use.
2. Create a php file, name it as you like and copy the below admin wrapper script to the file.
------ ADMIN WRAPPER SCRIPT STARTS BELOW THIS LINE ------
------ ADMIN WRAPPER SCRIPT ENDS ABOVE THIS LINE ------
3. Set a good, secure and unique password in the PASSWORD option in the admin wrapper script.
4. Place the admin wrapper php file in the same directory as the gallery script.
5. Now only link to the public gallery on your page. And use the admin wrapper script to login and administer the gallery.
USING THE ADMIN FUNCTIONS:
When this option is set to TRUE, the "Admin" button will be shown in the bottom menu. Click it to enter administrator menu.
While in the administrator menu: Clicking an element (directory, image or file), will select the element (will be highlighted). Clicking a selected elements will deselected the element again.
To upload files or images to the current directory:
1. Click the "Admin" button.
2. Click the "Upload" button.
3. Click the button normally called "Browse" or "Choose Files" (browser dependend).
4. Select the files you want to upload. (On Windows multiple files can be selected by holding CTRL down).
5. Click the "Upload" button.
To delete elements from the gallery:
1. Click the "Admin" button.
2. Select the elements that should be deleted.
3. Click "Delete".
4. Confirm.
To move elements in the gallery:
1. Click the "Admin" button.
2. Select the elements that should be moved.
3. Click "Move" (a tree view of the directories in the GALLERY_ROOT will be shown).
4. Browse to the directory you want to move the selected elements.
5. Confirm.
To rename elements from the gallery:
1. Click the "Admin" button.
2. Select the element (only one) that should be renamed.
3. Click "Rename".
4. Enter new name.
5. Confirm.
To create a new directory in the current directory:
1. Click the "Admin" button.
2. Click "Create Directory".
3. Enter new directory name.
4. Confirm.
To set a thumbnail for the current directory:
1. Click the "Admin" button.
2. Click the image that should be used as thumbnail for the directory. The chosen image must be of same type as DIR_THUMB_FILE. (A copy of the chosen image will be named as DIR_THUMB_FILE and will used as thumbnail. The chosen image will stay untouched in the gallery).
3. Click "Dir Thumb".
4. Confirm.
To remove the thumbnail for the current directory: (Will delete the DIR_THUMB_FILE in current directory. Script will chose a new image to use as thumbnail if any is available):
1. Click the "Admin" button.
2. Click "Dir Thumb" (without selecting any images).
3. Confirm.
____________________________________________________________
option('DIR_NAME_FILE', '_name.txt');
Set the name of the file that can be placed in every directory of the gallery.
If a file with the given name is found, the first line of text from the file will be used instead of the directory name. Directories will still be sorted after the actual name.
IMPORTANT: The file name in this option must end with the extension in DESC_EXT. Default value for DESC_EXT is '.txt'.
TIP 1: This is useful if you would like to use chars that cannot be used in directory names.
TIP 2: See SORT_DIVIDER for an easy way of sorting directories, images and files.
____________________________________________________________
option('DIR_THUMB_FILE', '_image.jpg');
Set the name of the image that can be placed in every directory in the gallery.
If an image with the given name is found, it will be used as thumbnail for that directory. The image will not be displayed inside the directory.
You can also place an image with the given name in the ICONS_DIR, to have it used as thumbnail on all directories that do not have images inside.
To use the ICONS_DIR image as thumbnail on all directories, with or without images inside, set the DIR_THUMB_FROM_ICONS_DIR to TRUE.
TIP 1: This is very useful when having directories with only files of non-supported image types for download.
TIP 2: You do not have to resize the image, it will be resized like all other images in the gallery.
____________________________________________________________
option('DIR_THUMB_FROM_ICONS_DIR', FALSE);
Set to TRUE to have the DIR_THUMB_FILE from the ICONS_DIR used as thumbnail on all directories.
Set to FALSE to let the script follow normal selection for directory thumbnails.
Order for selection of thumbnails for a directories (the first existing image is chosen):
1. DIR_THUMB_FILE from the directory.
2. If DIR_THUMB_FROM_ICONS_DIR is set to TRUE: DIR_THUMB_FILE from ICONS_DIR.
3. First image in the directory.
4. First DIR_THUMB_FILE or image from subdirectories.
5. DIR_THUMB_FILE from ICONS_DIR.
____________________________________________________________
option('DIR_DESC_FILE', '_desc.txt');
Set the name of the description file that can be placed in every directory of the gallery (including the GALLERY_ROOT).
If a file with the given name is found, the text will be shown in the gallery. If text includes HTML tags, HTML_DESCRIPTIONS must be set to TRUE.
IMPORTANT: The file name in this option must end with the extension in DESC_EXT. Default value for DESC_EXT is '.txt'.
INFO: See DIR_DESC_IN_GALLERY and DIR_DESC_IN_INFO for placing the description in the gallery.
____________________________________________________________
option('DIR_BANNER_FILE', '_banner.txt');
Set the name of the banner file that can be placed in every directory of the gallery (including the GALLERY_ROOT).
If a file with the given name is found, the text in the file will be shown in the gallery, above the thumbnail boxes. If text includes HTML tags, HTML_DESCRIPTIONS must be set to TRUE.
If the TEXT_BANNER option is defined, and the DIR_BANNER_FILE is found in a directory, only the DIR_BANNER_FILE text is displayed in the gallery.
____________________________________________________________
option('DIR_ROOT_BANNER_IN_SUBDIRS', TRUE);
Set to TRUE to have the DIR_BANNER_FILE, that is placed in the root of the gallery, used as banner in all sub directories.
Set to FALSE to only show the DIR_BANNER_FILE, that is placed in the root of the gallery, when viewing the root directory (also called Home).
INFO: When this is set to TRUE, you can still override the root banner in a sub directory by placing a banner file in a sub directory.
____________________________________________________________
option('DIR_DESC_IN_GALLERY', TRUE);
Set to TRUE to have description shown in the gallery as the first element, using a thumbnail box that is twice as wide as normal thumbnail boxes.
Set to FALSE to not show description in the gallery.
____________________________________________________________
option('DIR_DESC_IN_INFO', TRUE);
Set to TRUE to have description shown in the information panel.
Set to FALSE to not have description shown in the information panel.
____________________________________________________________
option('DIR_SORT_REVERSE', FALSE);
Set to TRUE to sort directories in reverse order (highest to lowest).
Set to FALSE to sort directories in normal order (lowest to highest).
See also DIR_SORT_BY_TIME and SORT_ALL_NATURAL for other sorting options for dirs.
____________________________________________________________
option('DIR_SORT_BY_TIME', FALSE);
Set to TRUE to sort directories by modified time.
Set to FALSE to sort directories by name.
The modified time of a directory is normally updated when changes are made to the contents of the given directory. Even deleting a file or image can make the directory "new". (This might differ from platform to platform).
See also DIR_SORT_REVERSE and SORT_ALL_NATURAL for other sorting options for dirs.
____________________________________________________________
option('DIR_EXCLUDE', ['_sfpg_data', '_sfpg_zip', '_sfpg_icons']);
Set an array of directory names that should not be shown in the gallery.
Directory names should be entered in lower case.
Exclusion is not case sensitive. If you exclude 'oldimages', all the following directories will all be excluded: 'OldImages', 'oldImages', 'OLDIMAGES' and so on.
Example 1: option('DIR_EXCLUDE', ['cgi-bin']);
Example 1: option('DIR_EXCLUDE', ['_sfpg_data', 'include', 'old_images']);
See also DIR_EXCLUDE_REGEX, FILE_EXCLUDE and FILE_EXT_EXCLUDE for other ways of excluding elements from the gallery.
____________________________________________________________
option('DIR_EXCLUDE_REGEX', '');
Use regular expressions to exclude directories from gallery view.
See here for syntax: https://php.net/manual/en/pcre.pattern.php
____________________________________________________________
option('SHOW_IMAGE_EXT', FALSE);
Set to TRUE to show image name extensions.
Set to FALSE to not show image name extensions.
____________________________________________________________
option('IMAGE_SORT_REVERSE', FALSE);
Set to TRUE to sort images in reverse order (highest to lowest).
Set to FALSE to sort images in normal order (lowest to highest).
See also IMAGE_SORT_BY_TIME, SORT_ALL_NATURAL and IMAGE_EXIF_TIME for other sorting options for images.
____________________________________________________________
option('IMAGE_SORT_BY_TIME', FALSE);
Set to TRUE to sort images by modified time.
Set to FALSE to sort images by name.
See also IMAGE_SORT_REVERSE, SORT_ALL_NATURAL and IMAGE_EXIF_TIME for other sorting options for images.
____________________________________________________________
option('IMAGE_EXIF_TIME', FALSE);
Set to TRUE to have images sorted by time found in EXIF, when sorting images by time.
Set to FALSE to use filetime when sorting images by time.
The EXIF information, including EXIF time, is extracted when the thumbnails are generated, so sorting images by EXIF time will first be effective from second view of the gallery.
____________________________________________________________
option('ROTATE_IMAGES', TRUE);
Set to TRUE to have images rotated according to the orientation information in EXIF.
Set to FALSE to not rotate images.
Rotated images are saved on the server in the DATA_ROOT. This could take up a lot of disk space.
If images have been saved on server you will have to delete them in order to have changes to this option apply.
Rotating images will require twice the amount of memory, than that for generating thumbs.
____________________________________________________________
option('IMAGE_JPEG_QUALITY', 90);
Set the quality for jpeg images. Range from 0 (worst quality and smallest file size) to 100 (best quality and largest file size).
If images have been saved on server you will have to delete them in order to have changes to this option apply.
This setting is used for full size images. These are saved on server after being rotated or watermark have been added.
____________________________________________________________
option('IMAGE_EXCLUDE_REGEX', '');
Use regular expressions to exclude images from gallery view.
See here for syntax: https://php.net/manual/en/pcre.pattern.php
____________________________________________________________
option('SHOW_FILES', TRUE);
Set to TRUE to show non-image files and images of non-supported types as download links in the gallery.
Set to FALSE to only show images of supported types in the gallery.
If GALLERY_ROOT is set to an absolute path and SHOW_FILES is set to TRUE, then a symbolic link called "_sfpg_download" will be created in script directory. This link gives web access to the GALLERY_ROOT, enabling download of files.
If PHP do not have write access to script directory, this link can't be created and you will get a message saying "Unable to access file." when trying to download a file. To fix this create the "_sfpg_download" link manually, like this:
For Windows:
1. In a Command Prompt go to the script directory.
2. Run this command (insert the path from your GALLERY_ROOT except the last / instead of X): mklink /d _sfpg_download "X"
For Linux:
1. In a Terminal go to the script directory.
2. Run this command (insert the path from your GALLERY_ROOT except the last / instead of X): ln -s "X" _sfpg_download
TIP: Use FILE_EXCLUDE, FILE_EXT_EXCLUDE and FILE_EXCLUDE_REGEX to exclude files you do not want to have displayed.
____________________________________________________________
option('SHOW_FILE_EXT', TRUE);
Set to TRUE to show file name extensions.
Set to FALSE to not show file name extensions.
____________________________________________________________
option('FILE_IN_NEW_WINDOW', TRUE);
Set to TRUE to have files open in a new window.
Set to FALSE to have files open in the same window.
____________________________________________________________
option('FILE_THUMB_EXT', '.jpg');
Set the extension of file thumbnail files. Place an image with the same name as a file with the set extension added to the file name, to have the image used as a thumbnail for the file. The image will be resized like any other thumbnail in the gallery.
INFO 1: Can be set to any of the supported image types.
INFO 2: Case sensitivity in this option follows the case sensitivity of the server on which the script runs.
INFO 3: Extensions should be entered with a dot in front, like the default and the example below.
Example: If set to '.jpg' and one of the files is named 'In_The_Snow.mp4'. You can then make an image called 'In_The_Snow.mp4.jpg', and place it in the same directory as the image.
____________________________________________________________
option('FILE_THUMB_DEFAULT', '');
Set the name of the file that will be used as thumbnail for files that do not have a thumbnail file of its own, and which extension do not match any of the files in the ICONS_DIR.
The FILE_THUMB_DEFAULT image have to be placed in the ICONS_DIR.
____________________________________________________________
option('FILE_SORT_REVERSE', FALSE);
Set to TRUE to sort files in reverse order (highest to lowest).
Set to FALSE to sort files in normal order (lowest to highest).
See also FILE_SORT_BY_TIME and SORT_ALL_NATURAL for other sorting options for files.
____________________________________________________________
option('FILE_SORT_BY_TIME', FALSE);
Set to TRUE to sort files by modified time.
Set to FALSE to sort files by name.
See also FILE_SORT_REVERSE and SORT_ALL_NATURAL for other sorting options for files.
____________________________________________________________
option('FILE_EXCLUDE', ['_sfpg_zip']);
Set an array of file names that should not be shown in the gallery.
INFO 1: File names should be entered in lower case.
INFO 2: Exclusions works only on non-supported file types.
INFO 3: Exclusion is not case sensitive. If you exclude "readme.txt", all the following files will be excluded: "readme.txt", "ReadMe.Txt","README.TXT" and so on.
Example 1: option('FILE_EXCLUDE', ['readme.txt']);
Example 2: option('FILE_EXCLUDE', ['readme.txt', 'admin.php', 'style.css']);
See also FILE_EXT_EXCLUDE, FILE_EXCLUDE_REGEX and DIR_EXCLUDE for other ways of excluding elements from the gallery.
____________________________________________________________
option('FILE_EXT_EXCLUDE', ['.php', '.txt', '.sell']);
Set an array of file extensions for files that should not be shown in the gallery.
INFO 1: Extensions should be entered in low case with a dot in front, like the examples below.
INFO 2: Exclusions works only on non-supported file types. You cannot exclude the supported image types.
INFO 3: Exclusion is not case sensitive. If you exclude ".txt", all files with the following extensions will be excluded: ".txt", ".Txt", ".TXT" and so on.
The default exclusions are there because:
'.php' to not show the gallery it self, or other php files.
'.txt' to not show text files, as they by default are used for description.
'.sell' to not show the PayPal sell files. See PayPal options for more information on that.
Example 1: option('FILE_EXT_EXCLUDE', ['.php']);
Example 2: option('FILE_EXT_EXCLUDE', ['.php', '.txt', '.inc', '.html']);
Also see FILE_EXCLUDE, FILE_EXCLUDE_REGEX, DIR_EXCLUDE and DIR_EXCLUDE_REGEX for other ways of excluding elements from the gallery.
____________________________________________________________
option('FILE_EXCLUDE_REGEX', '');
Use regular expressions to exclude files from gallery view.
See here for syntax: https://php.net/manual/en/pcre.pattern.php
Example for excluding all files starting with a dot: option('FILE_EXCLUDE_REGEX', '/^[.]/');
____________________________________________________________
option('ICONS_DIR', '_sfpg_icons/');
Set the name of the directory where images to be used as thumbs for file types can be placed. If changed remember to also change the DIR_EXCLUDE option to not show it inside the gallery.
The directory must be placed inside the GALLERY_ROOT. The directory needs to end with a slash, like the default one: '_sfpg_icons/'.
The files in this directory must be the type defined by the option FILE_THUMB_EXT, by default: '.jpg'.
The name of the files should be the name of the extensions that they should be used for.
For an example if a file named "iso.jpg" is placed in this directory, all files ending with .iso will be given this image as thumbnail.
INFO: All images in ICONS_DIR should be entered in lower case, like the example above.
INFO: This option is optional. If not used, the directory does not need to exist.
____________________________________________________________
option('LINK_BACK', '');
Set an URL to show a button that will function as a link to the set URL. This can be used as a "Back to my site" button.
Set to '' to not show the button.
Example 1: Set to '/' to have button take you to the root of your web.
Example 2: Set to 'https://www.yoursite.com/page.html'.
See TEXT_LINK_BACK for the text on the button.
____________________________________________________________
option('CHARSET', 'utf-8');
Set the charset to be used. In order to have special chars display correctly, a charset that support the chars used in the gallery, must be set.
Below is a short list of charsets that can be used (use a search engine on the internet for others):
Universal Alphabet: 'utf-8'
Western Alphabet: 'iso-8859-1'
Central European Alphabet: 'iso-8859-2'
Latin 3 Alphabet: 'iso-8859-3'
Baltic Alphabet: 'iso-8859-4'
Cyrillic Alphabet: 'iso-8859-5'
Arabic Alphabet: 'iso-8859-6'
Greek Alphabet: 'iso-8859-7'
Hebrew Alphabet: 'iso-8859-8'
Japanese: 'shift-jis'
Chinese Traditional: 'big5'
____________________________________________________________
option('DATE_FORMAT', 'Day Date Month Year Hour:Min:Sec');
Set the format of the date/time to be used in the gallery.
The following variables can be used:
Day : Day name. Shown as: Mon, Tue, Wed, Thu, Fri, Sat, Sun
Date : Day number. Shown as: 1-31
Month : Month name. Shown as: Jan, Feb, Mar...
Nrmonth : Month number. Shown as: 1-12
Year : Year. Shown as: 1960-
Hour : Hours. Shown as: 00-23
Min : Minutes. Shown as: 00-59
Sec : Seconds. Shown as: 00-59
____________________________________________________________
option('DESC_EXT', '.txt');
Set the extension of the description files. Place a file with the same name as an image or file with the set extension added to the image name, to have the text shown with the image or file.
Case sensitivity in this option follows the case sensitivity of the server on which the script runs.
Extensions should be entered with a dot in front, like the example below.
Example: If set to '.txt' and one of the images is named
"IMG_10a.jpg". You can then make a file called
"IMG_10a.jpg.txt", and place it in the same directory as the image.
If SHOW_FILES is set to TRUE you can use FILE_EXT_EXCLUDE to exclude the description files from the view. So if you would like to list .txt but don't want the descriptions files shown, you should set to any other extension that you do not use (feel free to use ".sfpg") and exclude that one using FILE_EXT_EXCLUDE.
____________________________________________________________
option('HTML_DESCRIPTIONS', FALSE);
WARNING: Setting this option to anything but FALSE could allow malicious scripts imbedded in images and from description files to be executed in end user browser.
IMPORTANT: If files from untrusted sources are in the gallery, this option should be set to FALSE.
This setting have effect on contents from the following files: DIR_NAME_FILE, DIR_DESC_FILE, DIR_BANNER_FILE and alle description files for images and files defined by DESC_EXT.
Set to TRUE to allow all HTML from the above files.
Set to FALSE to block all HTML from the above files.
Set to a string of allowed HTML tags. HTML tags not listed will be stripped.
Set to an array of allowed HTML tags. HTML tags not listed will be stripped.
Example string configuration: option('HTML_DESCRIPTIONS', '