Apache::Gallery(3pm)
π Apache::Gallery π
okay bestie, gather round, because this is Apache::Gallery(3pm) β yes, from the User Contributed Perl Documentation section, and yes it's as iconic as it sounds. It's a mod_perl handler that literally builds you an image gallery, and we're about to go through the whole thing together. no cap. π
β¨ NAME β¨
Apache::Gallery β a mod_perl handler that creates an image gallery. That's the whole name section. short, sweet, main character energy. π
πΈ SYNOPSIS πΈ
ngl the synopsis is doing the absolute least here: it just says to see the INSTALL file in the distribution for installation instructions. so like, go read INSTALL, bestie. that's where the setup tea is. π«Ά
π¦ DESCRIPTION π¦
okay so here's the vibe: Apache::Gallery creates a thumbnail index of each directory, and it lets you view your pictures in different resolutions. β¨
The pictures get resized on the fly and cached β so it's fast, it's cute, it's efficient, we love that for us. π
The gallery can be configured and customized in many ways, and β this is the part that ate β you can add a custom copyright image to all of your images without modifying the original. the originals stay pristine. periodt. π
π CONFIGURATION π
In your httpd.conf you set the global options for the gallery. You can also override each of the options in .htaccess files in your gallery directories. so yes, different vibes in different folders. we stan flexibility. π
The options are set in the httpd.conf/.htaccess file using this syntax:
PerlSetVar OptionName 'value'
Example:
PerlSetVar GalleryCacheDir '/var/cache/www/'
π GalleryAutoRotate
Some cameras, like the Canon G3, can detect the orientation of the pictures you take and will save this information in the 'Orientation' EXIF field. Apache::Gallery will then automatically rotate your images for you. β¨
This behavior is default, but you can disable it by setting GalleryAutoRotate to 0.
π GalleryCacheDir
The directory where Apache::Gallery should create its cache with the scaled pictures. The default is /var/cache/www/. Here, a directory for each virtualhost or location will be created automatically.
bestie, make sure your webserver has write access to the CacheDir or this whole thing is not gonna slay. π¨
π¦ GalleryTemplateDir
The full path to the directory where you placed the templates. This option can be used both in your global configuration and in .htaccess files β that way you can have different layouts in different parts of your gallery. iconic, honestly.
No default value β this option is required. (yes required required. don't skip it. π)
πΈ GalleryInfo
With this option you can define which EXIF information you would like to present from the image. The format is:
'<MyName => KeyInEXIF, MyOtherName => OtherKeyInEXIF'
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. so whatever you list here is the whole menu, no secret items. π
The default is '640 800 1024 1600'
β GalleryThumbnailSize
Defines the width and height of the thumbnail images.
Defaults to '100x75'
π§ GalleryThumbnailSizeLS
If set to '1', GalleryThumbnailSize is the long and the short side of the thumbnail image instead of the width and height.
Defaults to '0'.
π
GalleryCopyrightImage
The image you want to blend into your images in the lower right corner. This could be a transparent png saying "copyright my name 2001". π
Optional.
π GalleryWrapNavigation
Make the navigation in the picture view wrap around (so Next at the end displays the first picture, etc.)
Set to 1 or 0, default is 0
π GalleryAllowOriginal
Allow the user to download the Original picture without resizing or putting the CopyrightImage on it.
Set to 1 or 0, default is 0
π¦ GalleryAllowThumbOnly
If true, GalleryAllowThumbOnly allows fooimg.jpg?thumbonly urls to output the thumbnail of the image. This is useful when including images in a blog (or similar). so cute for embedding, fr fr.
Defaults to '0' (false).
π GallerySlideshowIntervals
With this option you can configure which intervals can be selected for a slideshow. The default is '3 5 10 15 30'
π₯ GallerySortBy
Instead of the default filename ordering, you can sort by any stat attribute. For example size, atime, mtime, ctime.
π GalleryDirSortBy
Set this variable to sort directories differently than other items β can be set to size, atime, mtime and ctime; setting any other value will revert to sorting by name.
β¨ GalleryMemoize
Cache EXIF data using Memoize β this will make Apache::Gallery faster when many people access the same images, but it will also cache EXIF data until the current Apache child dies. so like, it's a tradeoff bestie. π
π«Ά GalleryUseFileDate
Set this option to 1 to make A::G show the files timestamp instead of the EXIF value for "Picture taken".
πΈ GallerySelectionMode
Enable the selection mode. Select images with checkboxes and get a list of filenames. very "pick your faves" energy. β
π GalleryEXIFMode
You can choose how Apache::Gallery should display EXIF info from your images.
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. π¨
π 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:"
π¦ GalleryMaxThumbnailsPerPage
This option controls how many thumbnails should be displayed in a page. It requires $BROWSELINKS to be in the index.tpl template file. don't forget that part, bestie, or it's giving broken. π
β GalleryImgFile
Pattern matching the files you want Apache::Gallery to view in the index as thumbnails.
The default is '\.(jpe?g|png|tiff?|ppm)$'
π GalleryDocFile
Pattern matching the files you want Apache::Gallery to view in the index as normal files. All other filetypes will still be served by Apache::Gallery but are not visible in the index.
The default is:
'\.(mpe?g|avi|mov|asf|wmv|doc|mp3|mp4|ogg|pdf|rtf|wav|dlt|txt|html?|csv|eps)$'
π§ GalleryTTFDir
To use the GalleryCopyrightText feature you must set this option to the directory where your True Type fonts are stored. No default is set.
Example:
PerlSetVar GalleryTTFDir '/usr/share/fonts/'
π
GalleryTTFFile
To use the GalleryCopyrightText feature this option must be set to the name of the True Type font you wish to use.
Example:
PerlSetVar GalleryTTFFile 'verdanab.ttf'
π₯ GalleryTTFSize
Configure the size of the CopyrightText that will be inserted as copyright notice in the corner of your pictures.
Example:
PerlSetVar GalleryTTFSize '10'
π GalleryCopyrightText
The text that will be inserted as copyright notice.
Example:
PerlSetVar GalleryCopyrightText '(c) Michael Legart'
πΈ GalleryCopyrightColor
The text color of your copyright notice.
Examples:
White:
PerlSetVar GalleryCopyrightColor '255,255,255,255'
Black:
PerlSetVar GalleryCopyrightColor '0,0,0,255'
Red:
PerlSetVar GalleryCopyrightColor '255,0,0,255'
Green:
PerlSetVar GalleryCopyrightColor '0,255,0,255'
Blue:
PerlSetVar GalleryCopyrightColor '0,0,255,255'
Transparent orange:
PerlSetVar GalleryCopyrightColor '255,127,0,127'
π GalleryCopyrightBackgroundColor
The background-color of a GalleryCopyrightText
r,g,b,a β for examples, see GalleryCopyrightColor
β GalleryQuality
The quality (1-100) of scaled images.
This setting affects the quality of the scaled images. Set this to a low number to reduce the size of the scaled images. Remember to clear out your cache if you change this setting. Quality seems to default to 75, at least in the jpeg and png loader code in Imlib2 1.1.0.
Examples:
Quality at 50:
PerlSetVar GalleryQuality '50'
π¦ GalleryUnderscoresToSpaces
Set this option to 1 to convert underscores to spaces in the listing of directory and file names, as well as in the alt attribute for HTML <img> tags.
π GalleryCommentExifKey
Set this option to e.g. ImageDescription to use this field as comments for images.
π GalleryEnableMediaRss
Set this option to 1 to enable generation of a media RSS feed. This can be used e.g. together with the PicLens plugin from http://piclens.com
β¨ FEATURES β¨
okay bestie, hereβs the fun stuff this thing can do, and itβs honestly giving main character energy π
π Rotate images β auto-spin era
Some cameras β looking at you, Canon G3 π β can detect which way a pic is oriented and stash that info in the EXIF header. Apache::Gallery sees that and literally auto-rotates the image for you. No cap.
If your camera doesnβt do that, you can rotate manually β and yes, you can also use this to override what a fancy camera thinks. You can turn the whole auto thing off with the GalleryAutoRotate option.
To make it happen, you create a file named after the picture plus .rotate. Inside, put one of these numbers:
"1"β rotates clockwise by90degree"2"β rotates clockwise by180degrees"3"β rotates clockwise by270degrees
So if you want to rotate "Picture1234.jpg" 90 degrees clockwise, you make a file in the same directory called "Picture1234.jpg.rotate" and put the number 1 inside. Slay β¨
π« Ignore directories/files β not today, bestie
To ignore a directory or a file (any kind, not just images, periodt) you create a <directory|file>.ignore file. Thatβs it. Bye π
π¬ Comments β spill the tea
Wanna add comments to a directory? Make a <directory>.comment file. The first line can have "TITLE: New title" which becomes the page title, and then the rest is your comment on the following lines. For each picture, make a file called picture.jpg.comment β first line can have "TITLE: New title" (page title energy) and then your comment lines.
Example, because visuals are everything:
TITLE: This is the new title of the page
And this is the comment.<br />
And this is line two of the comment.
The visible name of the folder defaults to the folder name, but you can change it by creating a file <directory>.folder containing the visible folder name. Same vibe for files: visible name defaults to the file name, but you can change it with a <file>.file file containing the visible file name.
You can also set GalleryCommentExifKey to the name of an EXIF field that has the comment, like ImageDescription.
Heads up: if a .comment file exists, it overrides the EXIF comment. Periodt π
π¦ DEPENDENCIES π¦
Bestie, youβre gonna need all this:
Perl 5Apache with mod_perlURI::EscapeImage::InfoImage::SizeText::TemplateImage::Imlib2X11 libraries(ie,XFree86)Imlib2β Remember the-devpackage when using rpm, deb or other package formats!
π AUTHOR π
Michael Legart <michael@legart.dk> β iconic, obviously π«Ά
π COPYRIGHT AND LICENSE π
Copyright (C) 2001-2011 Michael Legart <michael@legart.dk>
Templates designed by Thomas Kjaer <tk@lnx.dk>
Apache::Gallery is free software and is released under the Artistic License. See http://www.perl.com/language/misc/Artistic.html for details.
The video icons are from the GNOME project. http://www.gnome.org/
π«Ά THANKS π«Ά
Thanks to Thomas Kjaer for templates and design of http://apachegallery.dk. Thanks to Thomas Eibner and other for patches. (See the Changes file)
π SEE ALSO π
Go peek at: perl, mod_perl, Image::Imlib2, CGI::FastTemplate, Image::Info, and Image::Size.
This page is from Apache::Gallery(3pm), built for perl v5.36.0, dated 2022-12-02. Love that for us π
β¨
π¦ where this page comes from
- debian bookworm: libapache-gallery-perl 1.0.2-5.1
- debian trixie: libapache-gallery-perl 1.0.2-5.1
- ubuntu noble: libapache-gallery-perl 1.0.2-5.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms