Photo Image gallery V1
Site Admin Features
Script requirementPHP 5 ( Version ) and above with PDO support for MySQL database
Write permission to store upload images and directory config.php
Enter your MySQL database details ( login id , password , database name , server ).
Storing uploaded imagesInside config.php file you can set the location of uploaded image and the created thumbnail image. Note that the path is set relative to directory where script is executed.
By default we have kept two directories in script root and name of the directories are set in above variables. You can change them as per your requirement. Donít forget to give write permission to these directories to store images.
How to install the script.Download the zip file at the end of this page. Place the files in your server with PHP and MySQL.
Use the sql_dump.txt file to create your tables.
Entering site admin login details.In your server open the install.php file kept inside admin folder.
Enter your userid and password using the form provided.
For security reasons remove the install.php ( inside Admin folder ) file after adding admin login details to table.
Features of Admin areaThere is a login system to allow site admin to enter into admin area. For this the admin login details are stored in a table. User can use the install script to add admin userid and password. User can login and change the password. The login system is similar to member login system explained here.
There is a top link to navigate between different pages of admin area.
manage-photos.php : Managing Photos
This page uses Ajax to update data. This page also uses paging of records to display 10 thumbnail images. You can change the setting inside page to display different number of records per page.
Below each thumbnail image there is delete button to delete the image. There is a edit button to show a text field to enter title for the picture.
By default it displays all the images ( with paging of 10 records per page ) in the order of recently added photos showing first. At the end of the page there is a drop down to select one gallery. On Select of a gallery the page will refresh and show photos of selected gallery only.
manage-gallery.php ( managing gallery )
Photos are stored under one gallery. Users can create gallery while uploading photos. In this page all galleries listed with number of photos inside the gallery. There is a button to delete the gallery. A message box will be displayed asking users to confirm again before deleting the gallery and images.
On confirmation by the user all the filenames under the galley is collected and matching image files from upload and thumbnail directory are deleted. Then the records are deleted from plus2net_image tables and plus2net_gallery table.
Features of user areaUser area is kept open (without login ) in this script. You can integrate it to your secured area by adding checkings at top of the page.
Userid can be added to the uploaded records with gallery and photo information.
Users can use this file to upload images. Click Choose file button, browser window from local computer will be displayed. You can select images by clicking the file you want to upload. Hold the Ctrl button to select multiple images. Click the attach button to connect the images. Click the Upload Image button to start uploading of images. Note that only JPG files are allowed to upload.
Adding gallery by user
Users always upload images based on some area or event like winter garden flowers, sea beach, school union function etc. user will create gallery first and before uploading they have to select one gallery to assign against each photo uploaded. uploadck.php The file processing script is kept inside uploadck.php. This file we will execute in an iframe. So we can display uploaded images ( thumbnail image ) inside iframe so user can check the uploaded status. This script gets uploaded
User has to select one gallery before uploading, script will check gallery name and if not present then will stop script execution.
Resize of imagesAfter uploading the image is resized to 890 width and the height proportionally changed to maintain the aspect ratio . Thumbnail image size also can be set here. The variables are set like this.
You can change the above values inside uploadck.php file.
Thumbnail creationOne thumbnail image is created using the dimensions set by variables ( shown above ). Each image ( after resizing to 890 size ) will have one thumbnail image kept in a different folder. The main image ( of 890 size ) and thumbnail image both have same file name but kept in different folders.
This file receives gallery id from query string and gets all the photos using the gallery id. As we are using gal_id from query string so we must sanitize the variable before using inside our query. We will only allow integers as gal_id.
This page will use paging of records and by default it is set to 10 records per page. You can change it by changing the assigned value to the variable.
You can click any thumbnail displayed here to visit the full size photo page. photo.php
This page receives img_id from query string and display the big ( original ) photo. At the same time it will display thumbnail image of previous and next photo of same gallery. So users can easily navigate to other photos of the same gallery.
Additions to this scriptTo make it simple several features are not added to this script. Here are some of them.
Subscribe to our YouTube Channel here
This article is written by plus2net.com team. https://www.plus2net.com
| ▼ PHP MySQL Scripts