aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.php46
-rw-r--r--readme.txt61
2 files changed, 77 insertions, 30 deletions
diff --git a/index.php b/index.php
index 78ec739..7397bfc 100644
--- a/index.php
+++ b/index.php
@@ -2,12 +2,12 @@
/*
- Single File PHP Gallery 4.12.0 (SFPG)
+ Single File PHP Gallery 4.14.0 (SFPG)
See EULA in readme.txt for commercial use
See readme.txt for configuration
- Released: 2024-Sep-07
+ Released: 2024-Dec-17
https://sye.dk/sfpg/
by Kenny Svalgaard
@@ -28,6 +28,7 @@
option('DIR_DESC_FILE', '_desc.txt');
option('DIR_BANNER_FILE', '_banner.txt');
option('DIR_ROOT_BANNER_IN_SUBDIRS', TRUE);
+ option('DIR_NAME_AS_BANNER', FALSE);
option('DIR_DESC_IN_GALLERY', TRUE);
option('DIR_DESC_IN_INFO', TRUE);
option('DIR_SORT_REVERSE', FALSE);
@@ -133,6 +134,8 @@
option('SHOW_IMAGE_DAYS', FALSE);
option('DELETE_IMAGE_DAYS', FALSE);
option('DELETE_EMPTY_DIRS', FALSE);
+ option('RELOAD_IMAGE_MIN', 5000);
+ option('RELOAD_IMAGE_MAX', 10000);
option('PAYPAL_ENABLED', FALSE);
option('PAYPAL_ACCOUNT', '');
@@ -1591,6 +1594,12 @@
}
+ function reloadImage(imageID)
+ {
+ setTimeout(function(t) {t.src = t.src;}, Math.floor(Math.random() * (".(RELOAD_IMAGE_MAX - RELOAD_IMAGE_MIN + 1).") + ".RELOAD_IMAGE_MIN."), imageID);
+ };
+
+
function updateSize()
{
if (index)
@@ -1813,7 +1822,7 @@
{
if (isDef(dirInfo[id]['dirThumb']))
{
- info += '<img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+dirInfo[id]['dirThumb']+'\">';
+ info += '<img class=\"thumb\" onerror=\"reloadImage(this)\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+dirInfo[id]['dirThumb']+'\">';
}
else
{
@@ -1857,7 +1866,7 @@
}
else if (type == 'img')
{
- info += '<img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+imgInfo[id]['imageLink']+'\">';
+ info += '<img class=\"thumb\" onerror=\"reloadImage(this)\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+imgInfo[id]['imageLink']+'\">';
info += '</div>';
info += '<strong>".sts(TEXT_IMAGE_NAME)."</strong><br><div class=\"sfpg_info_text\">'+imgInfo[id]['imageName'] + '</div><br>';
";
@@ -2010,7 +2019,7 @@
{
if (isDef(fileInfo[id]['fileThumb']))
{
- info += '<img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+fileInfo[id]['fileThumb']+'\">';
+ info += '<img class=\"thumb\" onerror=\"reloadImage(this)\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+fileInfo[id]['fileThumb']+'\">';
}
else
{
@@ -2049,6 +2058,7 @@
}
else
{
+ fillInfo('dir', 0);
gebi('box_info').style.visibility='visible';
gebi('box_image').style.left='".INFO_BOX_WIDTH."px';
gebi('box_gallery').style.left='".INFO_BOX_WIDTH."px';
@@ -2663,7 +2673,10 @@
function mouseOver(that, type, nr)
{
- fillInfo(type, nr);
+ if (showInfo)
+ {
+ fillInfo(type, nr);
+ }
if (isSelected(type, nr))
{
that.className='innerbox_marked';
@@ -2685,7 +2698,10 @@
function mouseOut(that, type, nr)
{
- fillInfo('dir', 0);
+ if (showInfo)
+ {
+ fillInfo('dir', 0);
+ }
if (isSelected(type, nr))
{
that.className='innerbox_marked';
@@ -2758,7 +2774,7 @@
content += '<div class=\"thumbimgbox\">';
if (isDef(dirInfo[elementNumber]['dirThumb']))
{
- content += '<img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+dirInfo[elementNumber]['dirThumb']+'\">';
+ content += '<img class=\"thumb\" onerror=\"reloadImage(this)\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+dirInfo[elementNumber]['dirThumb']+'\">';
}
else
{
@@ -2776,7 +2792,7 @@
content += ' onmouseover=\"mouseOver(this, \'img\', '+elementNumber+')\" onmouseout=\"mouseOut(this, \'img\', '+elementNumber+')\"';
}
content += ' class=\"innerboximg\">';
- content += '<div class=\"thumbimgbox\"><img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+imgInfo[elementNumber]['imageLink']+'\"></div>';
+ content += '<div class=\"thumbimgbox\"><img onerror=\"reloadImage(this)\" class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+imgInfo[elementNumber]['imageLink']+'\"></div>';
". (THUMB_CHARS_MAX ? "content += thumbDisplayName(imgInfo[elementNumber]['imageName']);" : "")."
content += '</div>';
}
@@ -2791,7 +2807,7 @@
content += '<div class=\"thumbimgbox\">';
if (isDef(fileInfo[elementNumber]['fileThumb']))
{
- content += '<img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+fileInfo[elementNumber]['fileThumb']+'\">';
+ content += '<img class=\"thumb\" onerror=\"reloadImage(this)\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+fileInfo[elementNumber]['fileThumb']+'\">';
}
else
{
@@ -2852,6 +2868,10 @@
}
}
gebi('navi').innerHTML = navLinks;
+ if (gebi('banner'))
+ {
+ gebi('banner').innerHTML = dirInfo[0]['dirName'];
+ }
addElement(0, 'desc');
for (i = 1; i < dirInfo.length; i++)
{
@@ -4133,7 +4153,7 @@
'</table>'.
'</div>'.
'<div id="box_image" class="box_image">'.
- '<img alt="" src="data:," id="full" class="full_image" onclick="closeImageView()" onmouseover="gebi(\'button_close\').className=\'sfpg_button_hover\'" onmouseout="gebi(\'button_close\').className=\'sfpg_button\'">';
+ '<img alt="" onerror=\"reloadImage(this)\" src="data:," id="full" class="full_image" onclick="closeImageView()" onmouseover="gebi(\'button_close\').className=\'sfpg_button_hover\'" onmouseout="gebi(\'button_close\').className=\'sfpg_button\'">';
if(SHOW_IMAGE_NAME_BELOW_FULL)
{
echo '<div id="box_image_full_name"></div>';
@@ -4164,6 +4184,10 @@
{
echo '<div class="banner">'.TEXT_BANNER.'</div>';
}
+ elseif (DIR_NAME_AS_BANNER)
+ {
+ echo '<div class="banner"><h1 id="banner"></h1></div>';
+ }
echo '</div>';
if (ADMIN===TRUE)
{
diff --git a/readme.txt b/readme.txt
index dc21b25..b96069c 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,10 +1,10 @@
- Single File PHP Gallery 4.12.0 (SFPG)
+ Single File PHP Gallery 4.14.0 (SFPG)
See END USER LICENSE AGREEMENT for commercial
- Released: 2024-Sep-07
+ Released: 2024-Dec-17
https://sye.dk/sfpg/
By Kenny Svalgaard
@@ -102,8 +102,15 @@ IMPORTANT INFORMATION
____________________________________________________________
-NEWS IN THIS VERSION (4.12.0)
+NEWS IN THIS VERSION (4.14.0)
+ * Added function to automatically reload thumbnails that have failed to load.
+ * Added options RELOAD_IMAGE_MIN to allow setting lower limit for when to trigger a reload of thumbnails that have failed to load.
+ * Added options RELOAD_IMAGE_MAX to allow setting upper limit for when to trigger a reload of thumbnails that have failed to load.
+ * Added option DIR_NAME_AS_BANNER to allow showing directory names as banners above the thumbnails.
+ * Optimized so that the Info box is not updated by thumbnail mouseover when the Info box is not shown.
+
+News from previous version (4.12.0):
* Added a "spider" function that can be activated to generate thumbnails for new images in the gallery without having to browse the gallery.
* Added support for WebP images (Animated WebP images are not supported).
* Added WEBP_EXIF option for configuration of EXIF extraction from WebP images.
@@ -116,17 +123,6 @@ NEWS IN THIS VERSION (4.12.0)
* Fixed an issue where the DELETE_EMPTY_DIRS option would only function if GALLERY_ROOT was set to the default './' setting.
* Other minor fixes, changes and enhancements.
-News from previous version (4.11.0):
- * Added option to extract and show PNG text chunks information.
- * Fixed handling of images with corrupt EXIF date information.
-
-News from the version before previous version (4.10.0):
- * 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.
-
For changes in previous versions see here: https://sye.dk/sfpg/
@@ -449,7 +445,7 @@ 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.
+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 as banner in the gallery.
____________________________________________________________
@@ -462,6 +458,15 @@ INFO: When this is set to TRUE, you can still override the root banner in a sub
____________________________________________________________
+option('DIR_NAME_AS_BANNER', FALSE);
+
+Set to TRUE to have directory names shown as a banner above the thumbnails.
+Set to FALSE to not have directory names shown as a banner above the thumbnails.
+
+INFO: Placing a DIR_BANNER_FILE in a directory will override this option. A DIR_BANNER_FILE in the root of the gallery with the DIR_ROOT_BANNER_IN_SUBDIRS set to TRUE will also override this option.
+
+
+____________________________________________________________
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.
@@ -777,10 +782,10 @@ If SHOW_FILES is set to TRUE you can use FILE_EXT_EXCLUDE to exclude the descrip
____________________________________________________________
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.
+WARNING: Setting this option to anything but FALSE could allow malicious scripts embedded 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.
+This setting have effect on contents from the following files: DIR_NAME_FILE, DIR_DESC_FILE, DIR_BANNER_FILE and 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.
@@ -1359,6 +1364,24 @@ Empty directories are deleted when they are about to be listed as an element in
____________________________________________________________
+option('RELOAD_IMAGE_MIN', 5000);
+
+Set the minimum wait in milliseconds before a reload of the image/thumb is activated.
+
+Some servers have configurations that limit the number of calls they can accept within a given period. This may affect the functionality of loading thumbnails. Additionally, connection or performance issues could also prevent thumbnails from loading.
+If a thumbnail fails to load, a reload attempt will trigger at a random time between the specified number of milliseconds set in RELOAD_IMAGE_MIN and RELOAD_IMAGE_MAX.
+
+
+____________________________________________________________
+option('RELOAD_IMAGE_MAX', 10000);
+
+Set the maximum wait time in milliseconds before a thumbnail reload is triggered.
+
+Some servers have configurations that limit the number of calls they can accept within a given period. This may affect the functionality of loading thumbnails. Additionally, connection or performance issues could also prevent thumbnails from loading.
+If a thumbnail fails to load, a reload attempt will trigger at a random time between the specified number of milliseconds set in RELOAD_IMAGE_MIN and RELOAD_IMAGE_MAX.
+
+
+____________________________________________________________
option('PAYPAL_ENABLED', FALSE);
Set to TRUE to enable selling items in the gallery using PayPal.
@@ -1944,14 +1967,14 @@ Set to '' to not show the map link.
____________________________________________________________
option('TEXT_EXIF_MAP_EMBED', 'Image map');
-Set text for imbedded map label.
+Set text for embedded map label.
Set to '' to disable the embedded map in the gallery.
____________________________________________________________
option('EXIF_MAP_EMBED_LINK', 'https://maps.google.com/maps?q=[lat],[long]&output=embed');
-Set the link to map function like Google maps. The map is imbedded in the information panel in the gallery.
+Set the link to map function like Google maps. The map is embedded in the information panel in the gallery.
Latitude in decimal will be filled in where this string is: [lat]
Longitude in decimal will be filled in where this string is: [long]