Products | Scripts | Services | Tutorials | Books | Links | Contact | Bulletin Board

Nightmedia Scripts

Custom scripts | The CITY Shop | E-Payment Interface | Photo Gallery | New Development

The Photo Gallery

The Photo Gallery Script is the first Nightmedia commercial script. It retails $499 which includes install help. For a limited time you can get it for $199, including install support. Please use Paypal for ordering:

After submitting the payment, please send us an email with the ftp access data to your site, and a way for us to contact you for the installations particularities.

Basic features:
Manages multiple source directories, with different types of media, and allows building a database of description/links for the images in the source directories.

The script has a thumbnail creation feature, which uses the Image::Magick module. This module is not included in the distribution, but it can be downloaded as a free software from http://www.imagemagick.org/.

The script allows publishing of a subset of images from the source directory, using a template, to the associated web directory.

One of the main features of this script, is that it can be scheduled using your system scheduler, to perform the publishing task as necessary.

We are aware that there are similar products on the market, with more fancy, but keep in mind that this project was started a month ago, and features will be added as we go. The Shop was not bigger than that, when it began less than 2 years ago.

We deliver.

More information will be added soon, here is a demo link.



the admin user / pw is "admin"

please DO NOT change the "admin" user data, since we want all the people to see how this works. You can create your own user in the user database, and give yourself admin rights, if you want.

Installing the script

It installs like any other basic cgi script, but has one prerequisite:

Image::Magick - needs to be installed on the server. The Perl part of the program can be installed from CPAN, it is not the only thing that makes it tick though. The package has a binary part that eventually needs to be compiled to your OS. We can help install it, and we require for that shell access to the system you are installing it to.

We tried to make the install simple, although due to the way it operates we recommend to take advantage of our install assistance, since it might open severe security issues if installed improperly.

The first thing to change is the first line of script, and of course, the script path, in the BEGIN block. This has to be set to the root path of the script:

$BaseDir = 'w:/cgi/city/gallery';

 

Then, you need to edit the Library/This.pm and configure the basic data:

my $BaseDir = $UseModPerl ? '/mod-cgi/gallery' : '/cgi-bin/gallery';
my $ScriptURL = $BaseDir.'/gallery.cgi';
my $DataPath = './Data';
my $SessionPath = './Sessions';
my $DefTemplate = './Source/default/template.html';
my $AdminMail = 'office@nightmedia.net';
my $UseCookies = 1;
my $CookieDomain = '.snowcrest.net';
my $ValidBasePath = [(
  'w:/http/city/',
)];

The $BaseDir is the aliased directory for the script, depending whether you are using mod_perl or not. Even if you are using only mod_perl, be aware that you will need the standard mode when you are customizing the script template package. Mod_perl loads everything in memory, and the only way you will see your changes is if you restart the web server.

$ScriptURL is the script URL, excluding the domain path. It is used for the form tags, and of course, to build the links throughout the shop. If you change your script name from .cgi to .pl, or choose an entirely different name, you will have to change it here too.

$DataPath is the path where you keep the user database, and the directory database.

$SessionPath is the path for the session files. The session files maintain the user authentication data, and various other transitional data. We avoided saving such data in cookies, part cause of the sensitivity, part cause of the size of the handled data.

$DefTemplate is the file use as default template, should a certain gallery have no special requirements. It is useful during testing, to be able to switch back and forth between the templates.

$AdminMail as expected, is the mail for the site administrator. It is not currently used, but will be at a later date, when email functions will be implemented.

$UseCookies is a flag that enables the saving of the session ID only in a cookie.

$CookieDomain is the base domain for setting the cookie

$ValidBasePath is the most important security feature for this script. You should enter in this array alll base paths to your data directories only. That way, you avoid the misuse or hack attempts to your script. Even if somebody gets the password to your site, they cannot publish system sensitive information, by creating their own configuration, pointed to for example "/etc".

There will be no online interface to the This.pm file, and we will always recommend editing the file by hand, to avoid security issues from popping up...

 

The last step is to configure the AppConfig.pm for the default directory.

The gallery keeps the "default" entry as the reference which is used to create new configurations. We recommend populating this with a small set of neutral pics that can be used for testing porposes.

Any new directory created using the online interface, will use the data in the default directory, and make a copy of it in its own path. You will have then to change the paths to reflect the new settings.

The online interface will check for path validity, so you will have to create the source directories first.

 

Running the script

The Gallery can be run in a browser or at the command line.

At the command line, the format is the following (all in one line):

perl -e "$ENV{QUERY_STRING}='dir=default&PublishDataButton=1'   
 and `w:/cgi/city/gallery/gallery.cgi`"

This, of course, for NT systems. You should create a .cmd file with this line of script in it, then schedule the .cmd file to run when you desire. No authentication is necessary when it runs scheduled.

 

The template file

The Gallery uses a html template with XML tags that trigger the display of the page content.

The tags used in the template has one of the following formats:

<cityapp:AppData:TagName/>
<cityapp:Process:TagName:TagParams/>

Here is a list of valid tags, and their description:

<cityapp:AppData:PageTitle/>
This is the value of the key -DISPLAY_NAME from the directory setup.

<cityapp:AppData:Navigator/>
This tag displays the page navigator, if the page is in a sequence. The code for the navigator is generated in the library AppTemplates.pm.

<cityapp:AppData:PageNr/>
This is the number of the page, if the page is in a sequence.

<cityapp:AppData:DataDisplay/>
This tag returns the page content, as formatted in the library AppTemplates.pm.

The Process tags require extra processing, based on the passed parameter in the TagParams:

<cityapp:Process:LastPublished:TagParams/>
This tag supports the following values for TagParams:

  • DateAndTime - The date and time, as mm/dd/yyyy, hh:00
  • Date - Just the date, as mm/dd/yyyy

More tags will be added when required.