NAME

Image::Shoehorn::Gallery - generate ``smart'' HTML slideshows from a directory of image files.


SYNOPSIS

 use Image::Shoehorn::Gallery;

 Image::Shoehorn::Gallery->create({
                                   source      => "~/my-images",
                                   directory   => "/htdocs/images",
                                   url         => "http://mysite.com/images";,
                                   static      => 1,
                                   scales      => [
                                                   [ "thumb","75x50"  ],
                                                   [ "default", "50%" ],
                                                   [ "small","25%"    ],
                                                   [ "medium","50%"   ],
                                                ],
                                   scale_if    => { x => 400 , y => 300 },
                                   iptc        => ["headline","caption/abstract"],
                                   set_lang    => "en-ca",
                                   set_styles  => {
                                                  image => [
                                                            {title=>"my css",href=>"/styles.css"},
                                                           ],
                                                 },
                                   set_index_images => { default => 1 },
                                  });


DESCRIPTION

Image::Shoehorn::Gallery generates HTML slideshows from a directory of image files. But wait, there's more!

Image::Shoehorn uses XML::Filter::XML_Directory_2XHTML, XML::SAX::Machines and a small army of Image::* packages allowing you to :


PACKAGE METHODS


__PACKAGE__->create(\%args)

This is the magic spell that will create your galleries.

Valid arguments are :


NAMING CONVENTIONS

Let's say you've got an image named :

 20020603-my-new-toy.jpg

You've defined two ``views'' to be generated : small and medium. The following files will be created :

 20020603-my-new-toy.html
 20020603-my-new-toy-thumb.jpg **
 20020603-my-new-toy-small.jpg *
 20020603-my-new-toy-small.html
 20020603-my-new-toy-medium.jpg *
 20020603-my-new-toy-medium.html

 *  If you are rendering scaled images on the fly, with I<Apache::Image::Shoehorn>, 
    these files not be created until such a time as they are actually viewed

 ** Thumbnails are always generated, regardless of the I<static> flag. As mentioned 
    earlier, this is a feature. If you have a directory with many images, you will peg
    your web server the first time you have to render all those images for the index
    listing.

The package uses XML::Filter::XML_Directory_2XHTML which, a few steps up the inheritance tree, uses XML::Filter::XML_Directory_Pruner to exclude certain specific files from the directory (index) listing. The exact rule set currently used it :

  $xhtml->exclude(
                  starting => ["\\."],
                  ending   => ["html","tmp","~"],
                  # e.g. ending with "-thumb.jpg","-small.jpg" or "-medium.jpg"
                  matching => ["^(.*)-(".join("|","thumb",@{$views}).")\.([^\.]+)\$"],
                 );

The plan is to, eventually, teach XML::Filter::XML_Directory_Pruner to include and exclude widgets based on media type, at which point we could simply do :

 $xhtml->include( media => "image" );

But until then, it is recommended that you make sure your source images don't match the ``matching'' pattern describe above. Or if you just think I'm an idiot and have a better rule-set, send my a note and I'll probably include it.


CSS

The following CSS classes are defined for the HTML generated by the package.

They are provided as a reference in case you want to specify your own CSS stylesheet.


"index" page

 body {
      background-color: #ffffff;
      margin:0;
 }

 .breadcrumbs {
               display:block;
               background-color: #f5f5dc;
               padding:5px;
               margin-bottom:5px;
               border-bottom: solid thin;
  }

 .breadcrumbs-spacer {}

 .directory { margin-bottom:5px;clear:left; padding: 5px;}

 .file      { margin-bottom:5px;clear:left;padding: 5px;}

 .thumbnail { display:block;width:100px;float:left;}

 .file ul   { float:left;}


"image" page

 body {
        background-color: #ffffff;
        margin:0;
      }

 .breadcrumbs {
   display:block;
   background-color: #f5f5dc;
   padding:5px;
   margin-bottom:5px;
   border-bottom: solid thin;
 }

 .breadcrumbs-spacer {}

 .directory {
   padding: 5px;
 }

 .file {
   padding: 5px;
 }

 .menu {
        margin-bottom:5px;
        padding:5px;
 }

 .menu-link-previous {
                padding-right : 10px;
 }

 .menu-link-previous img {
                margin-right:15px;
 }

 .menu-link-index {
                 font-weight:600;
 }

 .menu-link-next {
                padding-left : 10px;
 }

 .menu-link-next img {
                margin-left:15px;
 }

 .content {
        padding-top:20px;
      }

 .image { 
        position:absolute;
        top:auto;
        right:auto;
        left:170px;
        bottom:auto;
 }

 .meta { 
        min-width:150px;
        max-width:150px;
        margin:5px;
 }  

 .links {
        border: solid thin;
        margin-bottom: 5px;
 }

 .links span {
        display:block;
        padding:3px;
 }

 .iptc { 
        background-color : #fffff0;
        border-top: solid thin; 
        border-left: solid thin;
        border-right: solid thin;
        margin-bottom : 5px;
      }

 .iptc span { 
        display:block; 
        padding:3px;
        border-bottom:solid thin;
 }

 .iptc-field { 
        background-color : #f5f5dc;
        color:#a52a2a;
        border-bottom:solid thin #000;
        }

 .exif { 
        background-color : #f5f5dc;
        border-top: solid thin; 
        border-left: solid thin; 
        border-right: solid thin; 
        margin-bottom : 5px; 
        }

 .exif span { 
        display:block; 
        padding:3px;
        border-bottom:solid thin;
 }

 .exif-field { 
        color:#a52a2a;
        background-color:#cccc99;
        border-bottom:solid thin #000;
        }


VERSION

0.21


AUTHOR

Aaron Straup Cope


DATE

August 02, 2002


TO DO


BACKGROUND

http://aaronland.net/weblog/archive/3940

http://aaronland.net/weblog/archive/4474

http://www.la-grange.net/2002/07/22.html


EXAMPLE

http://perl.aaronland.info/image/shoehorn/gallery/www/example/index.html


REQUIREMENTS

XML::Filter::XML_Directory_2XHTML

XML::Filter::XSLT

XML::SAX::Machines

XML::SAX::Writer

Image::Shoehorn

Image::IPTCInfo

Image::Info

Digest::MD5


BUGS

Undoubtedly. So far, it works for me.


LICENSE

Copyright (c) 2002, Aaron Straup Cope. All Rights Reserved.

This is free software, you may use it and distribute it under the same terms as Perl itself.