Apache-Gallery

 view release on metacpan or  search on metacpan

INSTALL  view on Meta::CPAN


If you use Apache 1.3 and mod_perl 1, you need to configure
your virtualhostblock to look like:

<VirtualHost *>
	ServerName   gallery.yourdomain.org
	DocumentRoot /data/pictures/
	ErrorLog     logs/gallery-error_log
	TransferLog  logs/gallery-access_log
	PerlSetVar   GalleryTemplateDir '/usr/local/apache/gallery/templates/default/'
	PerlSetVar   GalleryInfo 'Picture Taken => DateTimeOriginal, Flash => Flash' 
	PerlSetVar   GallerySizes '640 1024 1600 2272'
	PerlSetVar   GalleryThumbnailSize '100x75'
	PerlSetVar   GalleryCopyrightImage 'htdocs/c.png'
	<Location />
		SetHandler        perl-script
		PerlHandler       Apache::Gallery
	</Location>
</VirtualHost>

In case you run apache 2 and modperl 2 (or 1.99), it needs to look
like:

<VirtualHost *>
	ServerName   gallery.yourdomain.org
	DocumentRoot /data/pictures/
	ErrorLog     logs/gallery-error_log
	TransferLog  logs/gallery-access_log
	PerlSetVar   GalleryTemplateDir '/usr/local/apache/gallery/templates/default/'
	PerlSetVar   GalleryInfo 'Picture Taken => DateTimeOriginal, Flash => Flash' 
	PerlSetVar   GallerySizes '640 1024 1600 2272'
	PerlSetVar   GalleryThumbnailSize '100x75'
	PerlSetVar   GalleryCopyrightImage 'htdocs/c.png'
	PerlOptions +GlobalRequest
	<Location />
		SetHandler        modperl
		PerlResponseHandler       Apache::Gallery
	</Location>
</VirtualHost>

README  view on Meta::CPAN


        Examples of keys: ShutterSpeedValue, ApertureValue, SubjectDistance,
        and Camera

        You can view all the keys from the EXIF header using this
        perl-oneliner:

        perl "-e" 'use Data::Dumper; use Image::Info qw(image_info); print
        Dumper(image_info(shift));' filename.jpg

        Default is: 'Picture Taken => DateTimeOriginal, Flash => Flash'

    GallerySizes
        Defines which widths images can be scaled to. Images cannot be
        scaled to other widths than the ones you define with this option.

        The default is '640 800 1024 1600'

    GalleryThumbnailSize
        Defines the width and height of the thumbnail images.

README  view on Meta::CPAN

        you configure with GalleryInfo. The information will be parsed into
        $INFO in pictureinfo.tpl.

        You can also set it to 'values' which will make A::G parse the
        configured values into the var $EXIFVALUES as 'value | value |
        value'

        If you set this option to 'variables' the items you configure in
        GalleryInfo will be available to your templates as $EXIF_<KEYNAME>
        (in all uppercase). That means that with the default setting
        "Picture Taken => DateTimeOriginal, Flash => Flash" you will have
        the variables $EXIF_DATETIMEORIGINAL and $EXIF_FLASH available to
        your templates. You can place them anywhere you want.

    GalleryRootPath
        Change the location of gallery root. The default is ""

    GalleryRootText
        Change the name that appears as the root element in the menu. The
        default is "root:"

TODO  view on Meta::CPAN

$Date: 2004-04-12 19:49:02 +0200 (Mon, 12 Apr 2004) $

- Write a gallery-cleancache.pl script for removing entries in
  the cache where the original picture has been removed.

- /admin page to edit comments and .rotate file. (Cleanup in
  .cache when changing rotation)

- Write perlscript to make static html galleries.

- Sort by the DateTimeOriginal part of the EXIF header
  if possible

- Make the template and imagesystem pluggable

- Make scaling quality configurable

- Thumbnails are to be generated in tmp files first,
  then moved to the correct location.

- Use imlib_create_cropped_scaled_image in resizepicture

UPGRADE  view on Meta::CPAN


For users upgrading from 0.2 to 0.3:

There has been som changes to the templates. info.tpl and scale.tpl
were added and showpicture.tpl was changed a little.

InlineDir, imageinfo and imagesizes have been made configurable,
so please add

PerlSetVar   InlineDir '/usr/local/apache/Inline'
PerlSetVar   GalleryInfo 'Picture Taken => DateTimeOriginal, Flash => Flash' 
PerlSetVar   GallerySizes '640 1024 1600 2272'

to your virtualhost.

lib/Apache/Gallery.pm  view on Meta::CPAN


					my $rotate = readfile_getnum($r, $imageinfo, $thumbfilename.".rotate");

					# Debian bug #348724 <http://bugs.debian.org/348724>
					# HTML <img> tag, alt attribute
					my $filetitle = $file;
					$filetitle =~ s/_/ /g if $r->dir_config('GalleryUnderscoresToSpaces');

					my %file_vars = (FILEURL => uri_escape($fileurl, $escape_rule),
							 FILE    => $filetitle,
							 DATE    => $imageinfo->{DateTimeOriginal} ? $imageinfo->{DateTimeOriginal} : '', # should this really be a stat of the file instead of ''?
							 SRC     => uri_escape($uri."/.cache/$cached", $escape_rule),
							 HEIGHT => (grep($rotate==$_, (1, 3)) ? $thumbnailwidth : $thumbnailheight),
							 WIDTH => (grep($rotate==$_, (1, 3)) ? $thumbnailheight : $thumbnailwidth),
							 SELECT  => $select_mode?'<input type="checkbox" name="selection" value="'.$file.'">&nbsp;&nbsp;':'',);
					$tpl_vars{FILES} .= $templates{picture}->fill_in(HASH => {%tpl_vars,
												 %file_vars,
												},
										       );

					if ($media_rss_enabled) {

lib/Apache/Gallery.pm  view on Meta::CPAN

			$foundcomment = 1;
			$tpl_vars{COMMENT} = $comment_ref->{COMMENT} . '<br />' if $comment_ref->{COMMENT};
			$tpl_vars{TITLE} = $comment_ref->{TITLE} if $comment_ref->{TITLE};
		} elsif ($r->dir_config('GalleryCommentExifKey')) {
			my $comment = decode("utf8", $imageinfo->{$r->dir_config('GalleryCommentExifKey')});
			$tpl_vars{COMMENT} = encode("iso-8859-1", $comment);
		} else {
			$tpl_vars{COMMENT} = '';
		}

		my @infos = split /, /, $r->dir_config('GalleryInfo') ? $r->dir_config('GalleryInfo') : 'Picture Taken => DateTimeOriginal, Flash => Flash';
		my $foundinfo = 0;
		my $exifvalues;
		foreach (@infos) {
	
			my ($human_key, $exif_key) = (split " => ")[0,1];
			my $value = $imageinfo->{$human_key};
			if (defined($value)) {

				$foundinfo = 1;

lib/Apache/Gallery.pm  view on Meta::CPAN

			# Only for files that natively keep the EXIF info in the same file
			$imageinfo = image_info($file);
		}
	}

	unless (defined($imageinfo->{width}) and defined($imageinfo->{height})) {
		$imageinfo->{width} = $width;
		$imageinfo->{height} = $height;
	}

	my @infos = split /, /, $r->dir_config('GalleryInfo') ? $r->dir_config('GalleryInfo') : 'Picture Taken => DateTimeOriginal, Flash => Flash';
	foreach (@infos) {
		
		my ($human_key, $exif_key) = (split " => ")[0,1];
		if (defined($exif_key) && defined($imageinfo->{$exif_key})) {
			my $value = "";
			if (ref($imageinfo->{$exif_key}) eq 'Image::TIFF::Rational') { 
				$value = $imageinfo->{$exif_key}->as_string;
			} 
			elsif (ref($imageinfo->{$exif_key}) eq 'ARRAY') {
				foreach my $element (@{$imageinfo->{$exif_key}}) {

lib/Apache/Gallery.pm  view on Meta::CPAN

			}
			$imageinfo->{$human_key} = $value;
		} 
	}

	if ($r->dir_config('GalleryUseFileDate') &&
		($r->dir_config('GalleryUseFileDate') eq '1'
		|| !$imageinfo->{"Picture Taken"} )) {

		my $st = stat($file);
		$imageinfo->{"DateTimeOriginal"} = $imageinfo->{"Picture Taken"} = scalar localtime($st->mtime) if $st;
	}

	return $imageinfo;
}

sub get_imageinfo_from_thm_file {

	my ($file, $width, $height) = @_;

	my $imageinfo = undef;

lib/Apache/Gallery.pm  view on Meta::CPAN

to present from the image. The format is: '<MyName => KeyInEXIF, 
MyOtherName => OtherKeyInEXIF'

Examples of keys: B<ShutterSpeedValue>, B<ApertureValue>, B<SubjectDistance>,
and B<Camera>

You can view all the keys from the EXIF header using this perl-oneliner:

perl C<-e> 'use Data::Dumper; use Image::Info qw(image_info); print Dumper(image_info(shift));' filename.jpg

Default is: 'Picture Taken => DateTimeOriginal, Flash => Flash'

=item B<GallerySizes>

Defines which widths images can be scaled to. Images cannot be
scaled to other widths than the ones you define with this option.

The default is '640 800 1024 1600'

=item B<GalleryThumbnailSize>

lib/Apache/Gallery.pm  view on Meta::CPAN

The default setting is 'namevalue'. This setting will make 
Apache::Gallery print out the names and values of the EXIF values 
you configure with GalleryInfo. The information will be parsed into 
$INFO in pictureinfo.tpl.  

You can also set it to 'values' which will make A::G parse
the configured values into the var $EXIFVALUES as 'value | value | value'

If you set this option to 'variables' the items you configure in GalleryInfo 
will be available to your templates as $EXIF_<KEYNAME> (in all uppercase). 
That means that with the default setting "Picture Taken => DateTimeOriginal, 
Flash => Flash" you will have the variables $EXIF_DATETIMEORIGINAL and 
$EXIF_FLASH available to your templates. You can place them
anywhere you want.

=item B<GalleryRootPath>

Change the location of gallery root. The default is ""

=item B<GalleryRootText>

templates/bright/README  view on Meta::CPAN

For this template to work the first two of the following options are a necessity, option three and four only completes the
design.  Option two should of course be hacked to fit the EXIF from your camera.

Remember to copy the new gallery.css to your DocumentRoot as well.

PerlSetVar  GalleryEXIFMode         'variables'
PerlSetVar  GalleryInfo             'Model => Model, Timestamp => DateTimeOriginal, Exposure Time => ExposureTime, ISO Speed Rating => ISOSpeedRatings, Focal Length => FocalLength, ApertureValue => ApertureValue, Flash => Flash'
PerlSetVar  GalleryThumbnailSize    '140x105'
PerlSetVar  GalleryThumbnailSizeLS  1



( run in 0.382 second using v1.01-cache-2.11-cpan-05444aca049 )