RTapo.com Site Last updated 12/30/2011
Home  |  Email  |  Software  |  Websites |  Tutorials & Notes |  Development |  Downloads |  Resume

Home  >  concentricPreviewGallery

This Perl module generates html image galleries like the one shown below, in Table 1. It creates tables that have a large cell in the center, which is bordered along it's perimeter by proportionate smaller cells. When a small cell (thumbnail) is clicked on, the image in it appears in the center cell.

This page serves as the documentation for Modules::concentricPreviewGallery, and should provide enough information to use the module in a perl script. You can see the module perform in a demo cgi, and download the module source in a zip file (MD5: A38CB4F165136B29EBF2D9800B6B7639 cpg.zip).



Table 1



SYNOPSIS:         --- top ---

Listing 1Making A Gallery From An Iterator
use Modules::concentricPreviewGallery;

my $cpg = Modules::concentricPreviewGallery->new(
               images_directory      => "root/path/to/images",
               images_directory_url  => "http://www.yourdomain.com/images"
);

$cpg->make_gallery;
while (my $gallery_table = $cpg->next_gallery) {
   # do something with table in $gallery_table
   .
   .
   .
}

Listing 2Making A Gallery In Array Context
use Modules::concentricPreviewGallery;

my $cpg = Modules::concentricPreviewGallery->new(
               images_directory      => "root/path/to/images",
               images_directory_url  => "http://www.yourdomain.com/images"
);

my @gallery_tables = $cpg->make_gallery;
foreach my $gallery_table(@gallery_tables) {
   # do something with table in $gallery_table
   .
   .
   .
}

CONSTRUCTOR:      --- top ---

Listing 3Create Object To Be Configured With configure_gallery method
my $cpg = Modules::concentricPreviewGallery->new;

Listing 4Constructing With Required Arguments
my $cpg = Modules::concentricPreviewGallery->new(
               images_directory      => "root/path/to/images",
               images_directory_url  => "http://www.yourdomain.com/images"
);

Listing 5Constructor Specifying A File Type Filter
my $cpg = Modules::concentricPreviewGallery->new(
               images_directory      => "root/path/to/images/*.gif",
               images_directory_url  => "http://www.yourdomain.com/images"
);

Listing 6Constructor With A Path & File Array Reference
my $cpg = Modules::concentricPreviewGallery->new(
               images_directory_url  => "http://www.yourdomain.com/images",
               images_array          => [
                                                     "root/path/to/images/img1.jpg",
                                                     "root/path/to/images/img2.jpg",
                                                     "root/path/to/images/img3.jpg",

                                                      ...

                                                     "root/path/to/images/imgN.jpg"
               ]
);

Note: images_directory key not required in Listing 6 since local path information is in the array referenced by images_array.


Listing 7Constructor With A File Array Reference
my $cpg = Modules::concentricPreviewGallery->new(
               images_directory      => "root/path/to/images",
               images_directory_url  => "http://www.yourdomain.com/images"
               images_array          => [
                                                    "img1.jpg",
                                                    "img2.jpg",
                                                    "img3.jpg",

                                                     ...

                                                    "imgN.jpg"
               ]
);

Listing 8Constructing With A Configuration Hash
my $cpg = Modules::concentricPreviewGallery->new(%config);

Listing 9Constructing With A Configuration Hash Reference
my $cpg = Modules::concentricPreviewGallery->new(\%config);

Note: The new method returns a code reference to an anonymous subroutine.



OPTIONS:      --- top ---

table_type, image_height, image_width, thumb_pct, images_array, images_directory, images_directory_url, border_size, inner_border_size, border_color, inner_border_color, background_color.


OPTION DESCRIPTIONS:      --- top ---

table_type      --- top ---

valid args: 'html', 'style'

Description:

Determines if a table will use html borders or style borders. Style permits size and color configuration of a table's outer and inner borders.


image_height      --- top ---

valid args: integer

Description:

Center image height.


image_width      --- top ---

valid args: integer

Description:

Center image width.


thumb_pct      --- top ---

valid args: '100', '50', '33', '25'

Description:

Defines the dimensions for thumbnails as a percentage of center image dimensions. Incidentally determines number of images per gallery.

Note: Image sizes are manipulated through img tag height and width parameters. There is no image resizing or other image lib support.


images_directory      --- top ---

required valid args: valid, qualified directory path

Description:

images_directory tells the module which directory to parse for images. By default it parses for all jpg, gif, or png images. A filter may be specified to constrain the input. If the path specified by images_directory is invalid, images_directory will be ignored.


images_directory_url      --- top ---

required valid args: valid, qualified url starting with http://

Description:

images_directory_url provides a url to pre pend to image names in the table's img tags.


images_array      --- top ---

valid args: array reference

Description:

images_array value should be an array reference that points to an array of fully qualified image file names. The array pointed to by images_array may contain image file names only, if images_directory is also defined with a valid directory path. Any image not found will be discarded from the list.


border_size      --- top ---

valid args: integer 0 thru 10

Description:

Specifies the outer border size for both html and style gallery tables.



inner_border_size      --- top ---

valid args: integer 0 thru 10

Description:

Specifies the inner border size for style gallery tables. As of 05/2005, html inner border size continues to be fixed.


Valid Arguments For Color Attributes      --- top ---
  1. All RGB Hex codes 000000 thru ffffff
  2. The following named colors:

border_color      --- top ---

valid args: see color args list.


inner_border_color      --- top ---

valid args: see color args list.


background_color      --- top ---

valid args: see color args list.


METHODS:      --- top ---

configure_gallery, make_gallery, next_gallery.


METHOD DESCRIPTIONS:      --- top ---


configure_gallery method      --- top ---

Description:


$cpg->configure_gallery();

Accepts the same configuration options as new. Configuration is not cumulative. Each call to configure_gallery resets options to their default value unless overridden by an explicit argument pair in the list.


make_gallery method      --- top ---

Description:


$cpg->make_gallery;

Returns an integer in scalar context that is the number of complete gallery tables created. Returns a list of completed gallery tables in array context.


next_gallery method      --- top ---

Description:


my $gallery_table = $cpg->next_gallery;

Used after calling make_gallery in scalar context, to retrieve a gallery table. Returns 0 when there are no tables.


SEE ALSO:      --- top ---

CGI::Application::PhotoGallery - module to provide a simple photo gallery
Modules::concentricPreviewGallery Demonstration


AUTHOR:      --- top ---

RTapo, <reginald@rtapo.com>


DOWNLOAD:      --- top ---

Modules::concentricPreviewGallery Download (MD5: A38CB4F165136B29EBF2D9800B6B7639 cpg.zip)


COPYRIGHT AND LICENSE:      --- top ---

Copyright (C) 2005
This is free software. Distribute and/or modify it under the same terms as Perl itself.


Document Created May 21, 2005
Last update September 5, 2006

RTapo.com
Copyright ©2012
Site Last updated 12/30/2011