mkweb.pl

Hi readers!

I just have been wanting to post this code someplace for the longest time. It is a program I wrote a couple years ago when I got my first digital camera. I’ve been keeping my pictures in a neat folder structure, and have always wanted to put them online for easy access. I have my own linux server running 24/7 and have plenty of disk space kicking around on it. So one day I got down and dirty with my favorite language Perl. Perl is great because it’s a quick and dirty language and that is the way I like it. The way to use this script is really simple. Place it anywhere and run it once. It will tell you what arguments you need to specify. Typically I have a “pictures” user set up on my machine with no login (for security) and a public_html directory. Then I just do the following:

mkweb.pl ~pictures/public_html

The script then crawls through the folder and makes thumbnails of all the images (JPG, PPM, GIF, BMP), and posts links to any non-image files. The only files it deletes is those damn *.THM files my camera makes when taking video, and the ‘Thumbs.db’ Windows incessantly likes to create. Another thing this script does is if you have a ‘description.txt’ file inside a folder, it will take the contents and put them before the images in that folder. So you could comment your pictures and it would automatically put them on the site.
This program creates 3 files in your main pictures directory: index.html (the main page containing the frames), main.html (the directory and files frames), title.html (the title frame). The subsequent folders will then contain a directories.html (list of subdirectories), files.html (thumbnails and links to files) and another main.html. I have made plans to put those files in the Thumbs folder that it creates, but haven’t gotten to it, and probably never will.

I’m posting this program for the benefit of the community. It should appear on sourceforge.net. You can get the Perl script here. Hope someone uses it. Drop me a line if you do or if you have troubles.

Fekete András

Liked it? Take a second to support me on Patreon!

Leave a Reply