CGI::Application::PhotoGallery - module to provide a simple photo gallery.
use CGI::Application::PhotoGallery; my $webapp = CGI::Application::PhotoGallery->new( PARAMS => { photos_dir => '/path/to/photos', script_name => $0 } ); $webapp->run();
CGI::Application::PhotoGallery is a CGI::Application module allowing people to create their own simple photo gallery. There is no need to generate your own thumbnails since they are created on the fly (using either the GD or Image::Magick modules).
To use this module you need to create an instance script. It should look like:
#!/usr/bin/perl use CGI::Application::PhotoGallery; my $webapp = CGI::Application::PhotoGallery->new( PARAMS => { photos_dir => '/path/to/photos', script_name => $0 } ); $webapp->run();
You'll need to replace the "/path/to/photos" with the real path to your photos. There is no need to change the "script_name" parameter.
Put this somewhere where CGIs can run and name it something like index.cgi.
index.cgi
This gets you the default behavior and look. To get something more to your specifications you can use the options described below.
CGI::Application modules accept options using the PARAMS arguement to new(). To give options for this module you change the new() call in the instance script shown above:
new()
my $webapp = CGI::Application::PhotoGallery->new( PARAMS => { photos_dir => '/path/to/photos', script_name => $0, title => 'My Photos' } );
The title option tells PhotoGallery to use 'My Photos' as the title rather than the default value. See below for more information about title and other options.
title
photos_dir (required)
This parameter is used to specify where all of your photos are located. PhotoGallery needs to know this so i can display all of your photos.
script_name (required)
This parameter should stay as $0. It is needed because PhotoGallery links to itself and needs to know the name of the instance script.
$0
By default every page will start with the title "My Photo Gallery". You can specify your own using the title parameter.
thumb_size
By default PhotoGallery displays thumbnail images that are 100 x 100 on the index page. You can change this by specifying either 's' (50 x 50), 'm' (100 x 100) or 'l' (150 x 150) for this option.
's'
'm'
'l'
thumbs_per_row
The default number of thumbnails per row on the index page is 4. You can change it by specifying your own value in the instance script.
4
graphics_lib
You can specifify which graphics library you wish to use to size your thumbnails. Included in this package are Magick (Image::Magick) and the default: GD. You can also create your own if you wish.
Magick
GD
extensions
Should you wish, you can also specify the allowable extensions. The defaults are: png, gif, jpg and jpeg.
png
gif
jpg
jpeg
index_template
This application uses HTML::Template to generate its HTML pages. If you would like to customize the HTML you can copy the default form template and edit it to suite your needs. The default form template is called 'photos_index.tmpl' and you can get it from the distribution or from wherever this module ended up in your @INC. Pass in the path to your custom template as the value of this parameter.
@INC
See HTML::Template for more information about the template syntax.
single_template
The default template for an individual photo is called 'photos_single.tmpl' and you can get it from the distribution or from wherever this module ended up in your @INC. Pass in the path to your custom template as the value of this parameter.
Copyright 2002 - 2003, Brian Cassidy (brian@alternation.net).
Special thanks to jeffa, vladb, petruchio and jcwren from http://www.perlmonks.org for their help.
Thanks also to: Mark Stosberg Michael Heathman
Questions, bug reports and suggestions can be emailed directly to me at brian@alternation.net. I would also suggest subscribing to the CGI::Application mailinglist by sending a blank message to "cgiapp-subscribe@lists.erlbaum.net".
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
CGI::Application, HTML::Template, CGI::Application::MailPage
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
To install CGI::Application::PhotoGallery, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::Application::PhotoGallery
CPAN shell
perl -MCPAN -e shell install CGI::Application::PhotoGallery
For more information on module installation, please visit the detailed CPAN module installation guide.