------------------------------------------------------------------------ ctm.pl is a PERL script which generates Apache type maps for use with mod_negotiation. Useful, if you have a lot of images available in different formats you need type maps for, especially if you don't want to use MultiViews to decide, which of them will be sent back to the requesting browser. How it works: It creates type maps for all files having the same prefix (including all but the suffix) as the as parameter given files. ------------------------------------------------------------------------ Usage: ctm.pl [-m map-suffix] [-M mime.types file] [-Q quality file] \\ [-s suffixes to use] [-i suffixes not to use] file [file ...] -m map-suffix Use map-suffix as suffix for map files. Default ist "map". For images I suggest "img". -s suffix,suffix,... Create only maps for files with these suffixes. Default value are all suffixes which appear with one of the prefixes of the given files. -i suffix,suffix,... Create no maps for files with these suffixes. -M mime.types file Tell me where to find your mime.types file, if I can't find it in the standard locations. You may also set $MIMETYPES to the appropriate place. -Q quality file Tell me where to find your quality file, if it isn't at $HOME/.qualityrc or $QUALITYRC. ----------------------------------------------------------------------- The quality file tells ctm.pl and therewith your server, how good or bad the quality of the offered formats is. Allowed quality values are [0.0, 1.0]. Each entry consists of a comma-seperated list of suffixes and a quality value, seperated by blanks or tabs. Comments start with "#". Empty lines are ignored. My personal .qualityrc looks like this: png 1.0 # PNG compresses good and loss-free, has # 2D-interlacing and no copyright # problems, so it's generally the best # offer. gif 0.2 # GIF compress not as good as PNG for # bigger images, has only 1D-interlacing # and has questionable copyright # restrictions jpeg,jpg,jpe,jfif 0.8 # JPEG images compress very good but # lossy. xbm,xpm 0.3 # X pixel- and bit-maps have no # compression. ----------------------------------------------------------------------- A simple example: Assume there exist the following files: head.gif, head.png, head.jpg, test.gif, test/test.gif, test/test.jpg, test/head.png Then ctm.pl -m img head.gif test/test.jpg will create a two maps: * head.img for head.gif, head.png and head.jpg * test/test.img for test/test.gif and test/test.jpg test/head.png and test.gif won't appear in any of the both type maps. The content of the file head.img then may look like this: URI: head.gif Content-type: image/gif; qs=0.2 Content-length: 1862 URI: head.png Content-type: image/png; qs=1.0 Content-length: 2088 URI: head.jpg Content-type: image/jpeg; qs=0.8 Content-length: 534 ------------------------------------------------------------------------