View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Philippe M. Chiasson > Apache-AutoIndex > Apache::AutoIndex



Annotate this POD

Related Modules

View/Report Bugs
Module Version: 0.08   Source  


Apache::AutoIndex - Perl replacment for mod_autoindex and mod_dir Apache module


  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 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:

I will only list modification that might have occured in this perl version.





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:



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...


perl(1), Apache(3), Apache::Icon(3), Image::Magick(3) .


Please send any questions or comments to the Apache modperl mailing list <> or to me at <>


This code was made possible by :

Doug MacEachern

<> Creator of Apache::Icon, and of course, mod_perl.

Rob McCool

who produced the final mod_autoindex.c I copied, hrm.., well, translated to perl.

The mod_perl mailing-list

at <> for all your mod_perl related problems.


Philippe M. Chiasson <>


Copyright (c) 1999 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.

syntax highlighting: