PerlModule Apache::Icon PerlModule Apache::AutoIndex (PerlModule Image::Magick) optionnal PerlTransHandler Apache::AutoIndex::transhandler PerlHandler Apache::AutoIndex
This module can replace completely mod_dir and mod_autoindex standard directory handling modules shipped with apache. It can currently live right on top of those modules, but I suggest simply making a new httpd without these modules compiled-in.
To start using it on your site right away, simply preload Apache::Icon and Apache::AutoIndex either with:
PerlModule Apache::Icon PerlModule Apache::AutoIndex
in your httpd.conf file or with:
use Apache::Icon (); use Apache::AutoIndex;
in your require.pl file.
Then it's simply adding
PerlTransHandler Apache::Autoindex::transhandler PerlHandler Apache::AutoIndex
somewhere in your httpd.conf but outside any Location/Directory containers.
If used in a server using virtual hosts, since mod_perl doesn't have configuration merging routine for virtual hosts, you'll have to put the PerlHandler and PerlTransHandler directives in each and every <VHOST></VHOST> section you wish to use Apache::AutoIndex with.
It uses all of the Configuration Directives defined by mod_dir and mod_autoindex.
Since the documentation about all those directives can be found on the apache website at:
http://www.apache.org/docs/mod/mod_autoindex.html http://www.apache.org/docs/mod/mod_dir.html
I will only list modification that might have occured in this perl version.
AddDescription
DirectoryIndex
FancyIndexing - should use IndexOptions FancyIndexing since 1.3.2
IndexOptions - All directives are currently supported. And a few were added
HeaderName - It can now accept a list of files instead of just one
ReadmeName - It can now accept a list of files instead of just one
IndexIgnore
IndexOrderDefault
Thumbnails - Lisitng will now include thumbnails for pictures. Defaults to false.
ShowPermissions - prints file permissions. Defaults to false.
This is an expression that should producea complete <BODY> tag when eval'ed. One example could be :
PerlSetVar IndexHtmlBody 'E<lt>BODY BACKGROUND=\"$ENV{BACKGROUND}\"E<gt>'
This is a string that will be inserted inside the table tag of the listing like so : <TABLE $value>
This should be the url (absolute/relative) of a ressource that would be inserted right after the <BODY> tag and before anything else is written.
This should be the url (absolute/relative) of a ressource that would be inserted right before the </BODY> tag and after everything else is written.
If set to 1, the listing displayed will print usefull (well, to me) debugging information appended to the bottom. The default is 0.
Since version 0.07, generation of thumbnails is possible. This means that listing a directory that contains images can be listed with little reduced thumbnails beside each image name instead of the standard 'image' icon.
To enable this you simply need to preload Image::Macick in Apache. The IndexOption option Thumbnails controls thumbnails generation for specific directories like any other IndexOption directive.
The way thumbnails are generated/produced can be configured in many ways, but here is a general overview of the procedure.
For each directory containing pictures, there will be a .thumbnails directory in it that will hold the thumbnails. Each time the directory is accessed, and if thumbnail generation is active, small thumbnails will be produced, shown beside each image name, instaed of the normal , generic, image icon.
That can be done in 2 ways. In the case the image is pretty small, no actual thumbnail will be created. Instead the image will be resized with the HEIGHT and WIDTH attributes of the IMG tag.
If the image is big enough, it is resized with Image::Magick and saved in the .thumbnails directory for the next requests.
Change in the configuration of the indexing options will correctly refresh the thumbnails stored. Also if an original image is modified, the thumbnail will be modified accordingly. Still, the browser might screw things up if it preserves the cached images.
The behaviour of the Thumbnail generating code can be customized with these PerlSetVar variables:
This is the name of the directory in wich generated thumbnails will be created. Make sure the user under wich the webserver runs has read and write privileges. Defaults to .thumbnails
Specifies that when a cache directory isn't found, should an attempt to create it be done. Defaults to 1(true), meaning if possible, missing cache directories will be created.
This value fixes the size of an image at wich thumbnail processing isn't even attempted. Since trying to process a few very big images could bring a server down to it's knees. Defaults to 500,000
This value fixes the size of an image at wich thumbnail processing isn't actually done. Since trying to process already very small images could would be an overkill, the image is simply resized withe the size attributes of the IMG tag. Defaults to 5,000.
This value fixes the x-size of an image at wich thumbnail processing isn't actually done. Since trying to process already very small images could would be an overkill, the image is simply resized withe the size attributes of the IMG tag. Defaults to 4 times the default icon width.
This value fixes the y-size of an image at wich thumbnail processing isn't actually done. Since trying to process already very small images could would be an overkill, the image is simply resized withe the size attributes of the IMG tag. Defaults to 4 times the default icon height
This value fixes an x-scaling factor between 0 and 1 to resize the images with. The image ratio will be preserved only if there is no scaling factor for the other axis of the image.
This value fixes an y-scaling factor between 0 and 1 to resize the images with. The image ratio will be preserved only if there is no scaling factor for the other axis of the image.
This value fixes a fixed x-dimension to resize the image with. The image ratio will be preserved only if there is no fixed scaling factor for the other axis of the image. This has no effect if a scaling factor is defined.
This value fixes a fixed x-dimension to resize the image with. The image ratio will be preserved only if there is no fixed scaling factor for the other axis of the image. This has no effect if a scaling factor is defined.
The transhandler problem should be fixed.
Some minor changes to the thumbnails options will still have the thumbnails re-generated. This should be avoided by checking the attributes of the already existing thumbnail.
Some form of garbage collection should be performed or cache directories will fill up.
Find new things to add...
Please send any questions or comments to the Apache modperl mailing list <modperl@apache.org> or to me at <ozer@cpan.org>
This code was made possible by :
<dougm@pobox.com> Creator of Apache::Icon, and of course, mod_perl.
who produced the final mod_autoindex.c I copied, hrm.., well, translated to perl.
at <modperl@apache.org> for all your mod_perl related problems.
$> cvs -d :pserver:anoncvs@cvs.ectoplasm.org:/home/anoncvs login password: anoncvs $> cvs -d :pserver:anoncvs@cvs.ectoplasm.org:/home/anoncvs co Apache-AutoIndex
Copyright (c) 1999-2003 Philippe M. Chiasson. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|