CGI-Application-PhotoGallery

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Perl extension PhotoGallery.

0.16  Fri Mar 15 2013
    - fix Image::Magick thumbnails (Adam Bernard)

0.15  Fri Nov 20 2009
    - added max_height to match max_width (tlhackque@yahoo.com)

0.14  Mon Mar 17 2008
    - added Imager adaptor
    - caching configurability + fixes (tlhackque@yahoo.com, RT#33993)

0.13  Mon Mar 10 2008
    [Patched by "tlhackque@yahoo.com"]

Changes  view on Meta::CPAN

    - updated pod (closes RT #8805)
    - added pod test

0.02  Wed May 14 19:30:23 2003

    Thanks to Mark Stosberg and Michael Heathman for their input

    - Code cleanup
    - Changed runmode names (full, english names)
    - thumbnail size no longer specified in URL
    - You can use either GD or Image::Magick (or you can write
      your own interface)
    - You can specify what extensions to read
    - Crude thumbnail cache implemented
    - $0 was doing funky stuff on Win32; it's been fixed

0.01  Mon Sep  9 21:02:56 2002
    - original version; created by h2xs 1.21 with options
        -AX PhotoGallery

Makefile.PL  view on Meta::CPAN

requires 'File::Find::Rule';
requires 'File::ShareDir';
requires 'HTTP::Date';

test_requires 'Test::More';

feature 'GD Support',
    -default => 1,
    'GD';

feature 'Image::Magick Support',
    -default => 0,
    'Image::Magick';

feature 'Imager Support',
    -default => 0,
    'Imager';

install_share;

repository 'http://github.com/bricas/cgi-application-photogallery';

WriteAll;

README  view on Meta::CPAN

                photos_dir  => '/path/to/photos'
            }
        );
    
        $webapp->run();

DESCRIPTION
    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 => {

README  view on Meta::CPAN

    the index page. You can change this by specifying a number (in pixels)
    for this option.

  preview_thumbs
    Before viewing the entire contents of a gallery, you are shown a few
    preview image. The default number of thumbnails is 4. You can change it
    by specifying your own value in the instance script.

  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.

  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.

lib/CGI/Application/PhotoGallery.pm  view on Meta::CPAN

        }
    );
    
    $webapp->run();

=head1 DESCRIPTION

CGI::Application::PhotoGallery is a L<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 => {

lib/CGI/Application/PhotoGallery.pm  view on Meta::CPAN


=head2 preview_thumbs

Before viewing the entire contents of a gallery, you are shown a few
preview image. The default number of thumbnails is C<4>. You
can change it by specifying your own value in the instance script.

=head2 graphics_lib

You can specifify which graphics library you wish to use to size your
thumbnails. Included in this package are C<Magick> (Image::Magick) and
the default: C<GD>. You can also create your own if you wish.

=head2 index_template

This application uses L<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 C<@INC>.  Pass in the
path to your custom template as the value of this parameter.

lib/CGI/Application/PhotoGallery/Magick.pm  view on Meta::CPAN

package CGI::Application::PhotoGallery::Magick;

=head1 NAME

CGI::Application::PhotoGallery::Magick - Image::Magick-based graphics adaptor

=head1 SYNOPSIS

    use CGI::Application::PhotoGallery::Magick;
    
    my $lib     = CGI::Application::PhotoGallery::Magick->new;
    my $pngdata = $lib->resize( $file, 100 );

=head1 METHODS

=cut

use strict;
use warnings;

use Image::Magick;

our $VERSION = '0.16';

=head2 new( )

creates a new CGI::Application::PhotoGallery::Magick object.

=cut

sub new {

lib/CGI/Application/PhotoGallery/Magick.pm  view on Meta::CPAN

=head2 load( $file )

Loads C<$file> and returns a L<GD::Image>.

=cut

sub load {
    my $self = shift;
    my $file = shift;

    my $image = Image::Magick->new;

    $image->Read( $file );

    return $image;
}

=head2 size( $file )

Returns the width and height of C<$file>.

lib/CGI/Application/PhotoGallery/Magick.pm  view on Meta::CPAN


    my $image = $self->load( $file );

    return $image->Get( 'width', 'height' );
}

=head1 SEE ALSO

=over 4 

=item * L<Image::Magick>

=back

=head1 AUTHOR

Brian Cassidy E<lt>bricas@cpan.orgE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright 2003-2013 by Brian Cassidy



( run in 0.871 second using v1.01-cache-2.11-cpan-beeb90c9504 )