Welcome Guest! You need to login or register to make posts.



Go to last post Go to first unread
#1 Posted : Monday, March 29, 2010 6:46:34 PM(UTC)

Rank: Advanced Member

Joined: 3/9/2008(UTC)
Posts: 554

Was thanked: 1 time(s) in 1 post(s)

In this article, I describe how to integrate Single File PHP Gallery 4 into your site. Suppose, you have a page with Image Uploader, but have no gallery displaying images implemented in your project. If so, this solution is an easy way to solve this problem.

How does PHP Gallery work:
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 on your server and specify a path to the folder containing images. 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.

How to integrate PHP Gallery into your site:
  1. Download Single File PHP Gallery 4 archive and extract index.php from it. Rename this script to Gallery.php.
  2. Paste this script on your server.
  3. Open Gallery.php script, find "CONFIGURATION START" section, and configure the following parameters:
    //the path of the gallery root, where the images 
    //and sub directories containing images is placed.
    define("GALLERY_ROOT", "../Gallery/");  
    //the path to where thumbnails and 
    //other data should be saved.
    define("DATA_ROOT", "../Gallery/_thumbs/");
    NOTE: this folder contains auxiliary data, so it should be excluded from the gallery. In Gallery.php, find the CONFIGURATION START section and add this folder to the following array:
    $dir_exclude = array("_sfpg_data","_thumbs");

    Also make sure that you set write permissions for the Gallery folder.
  4. The following modification is needed to make a custom description file worked. Just replace this line:
    echo "imgInfo[" . ($item) . "] = '" . str_to_script(@file_get_contents(DATA_ROOT . "info/" . GALLERY . $val . ".sfpg")."|".@file_get_contents(GALLERY_ROOT . GALLERY . $val . DESC_EXT))."';\n\n";
    by this one:
    echo "imgInfo[" . ($item) . "] = '" . str_to_script(@file_get_contents(GALLERY_ROOT . GALLERY . $val . DESC_EXT))."';\n\n";
In attachment you can find demo sample which demonstrates how to use Single File PHP Gallery with Image Uploader.

Edited by moderator Monday, April 2, 2012 10:34:52 AM(UTC)  | Reason: Not specified

Aurigma Support Team

UserPostedImage Follow Aurigma on Twitter!
thanks 1 user thanked Tamila for this useful post.
IRHM73 on 3/8/2012(UTC)
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.