[Suggestion] Single File PHP Gallery

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Pilovali
Posts: 81
Joined: Sat Oct 03, 2015 7:11 pm
Location: The Netherlands
Contact:

[Suggestion] Single File PHP Gallery

Post by Pilovali »

Hello,

Single File PHP Gallery is a web gallery in one single PHP 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.
More info: http://sye.dk/sfpg/

Installation:

Code: Select all

cd /tmp
wget http://sye.dk/sfpg/Single_File_PHP_Gallery_4.5.7.zip
mkdir /var/www/gallery
unzip Single_File_PHP_Gallery_4.5.7.zip -d /var/www/gallery
You must change line 22 to 'define('SECURITY_PHRASE', 'true');' else the gallery won't load.

You need PHP 5 and php_gd (not installed by default, apt-get install php5-gd) installed.

Demo: http://s6.pilovali.nl/gallery/
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: [Suggestion] Single File PHP Gallery

Post by Fourdee »

Pilovali wrote:Hello,

Single File PHP Gallery is a web gallery in one single PHP 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.
More info: http://sye.dk/sfpg/

Installation:

Code: Select all

cd /tmp
wget http://sye.dk/sfpg/Single_File_PHP_Gallery_4.5.7.zip
mkdir /var/www/gallery
unzip Single_File_PHP_Gallery_4.5.7.zip -d /var/www/gallery
You must change line 22 to 'define('SECURITY_PHRASE', 'true');' else the gallery won't load.

You need PHP 5 and php_gd (not installed by default, apt-get install php5-gd) installed.

Demo: http://s6.pilovali.nl/gallery/
This looks great, awesome find.

My only concern is the end user and /var/www permissions. eg: user makes a folder /var/www/moo , user will need to chown -R www-data:www-data etc. However, i could put this in the online documentation.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: [Suggestion] Single File PHP Gallery

Post by Fourdee »

If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Pilovali
Posts: 81
Joined: Sat Oct 03, 2015 7:11 pm
Location: The Netherlands
Contact:

Re: [Suggestion] Single File PHP Gallery

Post by Pilovali »

Fourdee wrote: This looks great, awesome find.

My only concern is the end user and /var/www permissions. eg: user makes a folder /var/www/moo , user will need to chown -R www-data:www-data etc. However, i could put this in the online documentation.
You don't need to do that. If you want to make a new folder inside gallery/ (folder = album) it does not need special rights.
There is only one folder that needs chown'ed, and that is '_sfpg_data', it contains the thumbnails, EXIF data and cache, so it must be writeable for the webserver.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: [Suggestion] Single File PHP Gallery

Post by Fourdee »

Pilovali wrote:You don't need to do that. If you want to make a new folder inside gallery/ (folder = album) it does not need special rights.
There is only one folder that needs chown'ed, and that is '_sfpg_data', it contains the thumbnails, EXIF data and cache, so it must be writeable for the webserver.
Awesome!

I'll get this added for next release, then I really must start work on the Email stack/server for dietpi-software :).
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: [Suggestion] Single File PHP Gallery

Post by Fourdee »

Pilovali wrote:There is only one folder that needs chown'ed, and that is '_sfpg_data', it contains the thumbnails, EXIF data and cache, so it must be writeable for the webserver.
Spot on. We have to create the _sfpg_data dir, then set permissions.

Once LASP is installed:

Code: Select all

wget http://sye.dk/sfpg/Single_File_PHP_Gallery_4.5.7.zip -O package.zip
unzip package.zip -d /var/www/gallery
rm package.zip

#Get test images
mkdir -p /var/www/gallery/DietPi
wget http://dietpi.com/images/dietpi-logo_256.png -O /var/www/gallery/DietPi/logo_256.png
wget http://dietpi.com/images/dietpi-logo_150.png -O /var/www/gallery/DietPi/logo_150.png
#mkdir -p /var/www/gallery/Tr-Zero

#permissions for cache/thumbnail/database
mkdir -p /var/www/gallery/_sfpg_data
chown -R www-data:www-data /var/www/gallery/_sfpg_data
chmod -R 775 /var/www/gallery/_sfpg_data

#enable (Some type of security trigger)
sed -i "/define('SECURITY_PHRASE'/c\define('SECURITY_PHRASE', 'true');" /var/www/gallery/index.php
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Pilovali
Posts: 81
Joined: Sat Oct 03, 2015 7:11 pm
Location: The Netherlands
Contact:

Re: [Suggestion] Single File PHP Gallery

Post by Pilovali »

Keep in mind that php5-gd needs to be installed and after that, Apache2 needs to restart. It was not installed by default, atleast not for me.

If you want to test if the installation is succesful and if the gallery runs correctly, run this PHP script.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: [Suggestion] Single File PHP Gallery

Post by Fourdee »

Pilovali wrote:Keep in mind that php5-gd needs to be installed and after that, Apache2 needs to restart. It was not installed by default, atleast not for me.
Yep, seems php5-gd is needed for thumbnails.

Pilovali wrote:If you want to test if the installation is succesful and if the gallery runs correctly, run this PHP script.
Looking good:

Code: Select all

Single File PHP Gallery TEST FILE 1.5.0
------------------------------
1: PHP version: 5.6.13-0+deb8u1. ok.
2: PHP Memory limit: 128M
3: Checking required functions: All required functions found.
4: Checking GD version: GD version: 2.1.1-dev
5: Checking image type support: Support for: GIF JPG/JPEG PNG 
6: Testing to find maximum image size handling: (1024²)(2048²)(4096²)(8192²)(16384²)(!32768²)
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Pilovali
Posts: 81
Joined: Sat Oct 03, 2015 7:11 pm
Location: The Netherlands
Contact:

Re: [Suggestion] Single File PHP Gallery

Post by Pilovali »

Fourdee wrote: Yep, seems php5-gd is needed for thumbnails.
Did you add php5-gd to the installation LASP/LAMP installation?
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: [Suggestion] Single File PHP Gallery

Post by Fourdee »

Pilovali wrote:
Did you add php5-gd to the installation LASP/LAMP installation?
Nope, this is installed alongside the Php gallery.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Post Reply