Version: Gallery Version 1.1b (http://www.howqua.net/gallery) Copyright: Copyleft (C) 2005 Anthony Cassidy (timorg@howqua.net) For the licence of use and modification see the end of this file. The newest version (and the source) of this program is at the above site. If this gets moved to Source Forge, the above site will redirect. 0. Table of Contents: 1. The 5 W's 2 Running the Program 3. Thanks and Credits 4. About 5. Where to next 6. /me waves at 10. Licence 1. The 5 W's: Who: Anthony Cassidy (timorg@howqua.net) What: Takes a directory of images, produces thumbnails and a html gallery. When: Started on 28-Jan-2005 and reached Version 1.0 on the 4-Feb-2005 Where: Melbourne, Australia Why: Because my old gallery script doesn't work on my new web hosting 2.1 Running the Program: From the installer: run it run the command prompt start typing From the zip file: unzip it run 'setup_registry.exe' run 'create_batch.exe' run 'gallery_prompt.bat' start typing 2.2 Idiot's guide to this program: Drag a folder onto the desktop icon, or onto the 'gallery.exe' in the programs folder. To find the 'gallery.exe', in the start menu is a link to the directory the file is in. This program is really supposed to be used from the command line. but with the way windows treats draging and droping you can just be lazy, and hope for the best. (You might want to setup 'gallery.ini' so you can control the program settings.) If you want to run the program properly, use the command prompt, and type out the command line. 2.3 Something to note: If you didn't use the installer, before you use this program, you need to run 'setup_registry.exe', this will let the program know where you are using it from. After you have run that, you have to run 'create_batch.exe' to create the command prompt for you to use. If you want to uninstall the program, run 'setup_registry' again, if the program hasn’t been moved, 'setup_registry.exe' will remove the registry key used by the program. (HKEY_LOCAL_MACHINE\SOFTWARE\howqua\gallery) If the program has been moved it will setup the program to run from the new directory If you used the installer, then you probably won’t have this problem, unless you move the directory you installed it to. If you did you will need to run 'setup_registry.exe', this will let the program know where you moved its support programs to. You also will have to run 'create_batch.exe' to update the command prompt. (This could possibly cause problems if you move the program, the use the installer to reinstall. as it will detect the install path at the original location. using the uninstall program will still work fine. 2.4 Usage: Usage: [--help] [--config=] [-h ] [-w ] [-b ] [-o ] [-t ] [--recursive] [--verbose] [--crazy] [--quiet] [--pause] directory "--help" > Displays the usage glossary "--config=<config heading>" > base config to be used "-h", "--height=<n>" > Sets the height of the thumbnails, defaults to 100px "-w", "--width=<n>" > Sets the number of images per row of the gallery, defaults to 4 "-b", "--border=<n>" > Sets the size of the borders around the thumbnails (set to -1 to ignore the gallery.ini file setting) "-o", "--output=<html file>" > Sets the name of the html file, defaults to 'index.html' "-t", "--title=<title>" > Sets the topic of the html file, defaults to 'Image Gallery' "--recursive" > Convert all the subdirectories into gallaries, and it sets up a thumbnail using the 1st four > Images to create a thumbnail for the subdirectories. "--verbose" > Turns on debugging and other useless info "--crazy" > Turns on crazy amounts of debugging info and stuff "--quiet" > Turns off all output, error messages are still displayed, this overrides '--verbose' "--pause" > Makes the program wait for a keypress before closing directory > This is the directory you want to produce the gallery of, > don’t include the final '\' (this will be fixed at next revision) 2.5 Examples: gallery d:\images > Create a gallery of the images in the 'd:\images' directory (using default config) gallery --config=SINGLE d:\images > Create a gallery of the images in the 'd:\images' directory (using the config SINGLE) gallery -h 150 -w 3 -t "Cool Images" --pause "d:\my images" gallery --height=150 --width=3 --title="Cool Images" --pause "d:\my images" > Creates a gallery of the images in the "d:\my images" directory > The thumbnails 150px high and there are 3 images per row, > the gallery has the title "Cool Images, and pauses at the end of output Drag and Drop a directory onto the executable or desktop icon > Creates a gallery of the images in the directory, using the default settings. 3. Thanks and Credits: 'ls.exe', 'mv' and 'pwd.exe' came from (http://unxutils.sourceforge.net/) Thanks to Karl M. Syring, I didn't really need them to make this program, but I use his binaries for everyday command prompt stuff. (They will also ease the porting to linux) 'identify.exe' and 'convert.exe' comes from (http://www.imagemagick.org/) Thanks to Image Magick, without them this program wouldn't have been possible. I wouldn't have been able to produce the thumbnails. The class that I use to access the registry came from (http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=2599&lngWId=3) Thanks to Yves Lessard for their (his?) code, it saved me a lot of time and effort. I hope to go though the code and really understand how to access the registry. If I can’t get the code to compile with mingw, I will try porting it. The command line parsing code came from (http://argtable.sourceforge.net/) Thanks to Stewart Heitmann for this awesome library, it made doing the command line stuff a breeze, I have always had problems doing command lines, but with this library its a thing of the past, argtable is great. I just have to work out how to statically link it into my programs. (I worked it out :D) The installer program was created with NSIS and HM NIS EDIT from (http://nsis.sourceforge.net/) and (http://hmne.sourceforge.net/) respectively. When these two are put together, you have a quick and simple solution to creating an installer. The ini file parser code came from (http://libini.sourceforge.net/) Thanks to Simon White for his code. It saved me a heap of effort. Because of his work, I implemented the gallery.ini file, which allows the defaults to be setup. Unfortunately there is a memory leak in his code, but the fix was in the forum, its a shame that he hasnt updated his code with it. I had to manually make the changes.There isnt much of an example on the offical site, but I feel that this is a good basic example. Hopefully me using this library will encourage other people to use this lib. Thanks to Anthony Thyssen for his great site explaining the finer points of using imagemagick for creating thumbnails and other things. His site can be found at:(http://www.cit.gu.edu.au/~anthony/graphics/imagick6/) 4. About: I can sum all this up in one obscenity: OMFG The premise of the program is pretty simple, create a list of all the images in the directory, create the thumbnail directory, go down the list creating thumbnails and create the html file as you go. I decided to use ls.exe to produce the list of files, to make it easier for porting to Linux. I should have used "dir /b", but I thought what the hell, because I was already shipping 2 programs from Image Magick. The premise might have been simple, but the implementation was hell. I ran into so many problems, there was screaming and arm waving everywhere. I accidentally lost a piece of code. I changed code and forgot what I did and that broke stuff and OMFG. I am glad it’s done, because that means it was worth the effort. (That was written on the 4-Feb-2005, Its now the 15-Feb-2005, and i have been working on this for over a week since, adding features, the code base is currently at 1.1b, and there is more stuff to add, but it is drawing to a close.) The 'int system(char *command)' function in MSVC doesn’t work properly, and I had massive problems getting it to run the system commands, I ended up writing the commands to a batch file, then executing that, and that didn’t work either, I ended up having to use cmd.exe to exec my batch file. I wasted 12 hours+ on that, but it’s done now. :D The implementation of 'ls.exe' that this program ships with is broken the -d flag doesn't work, so my function to check if a folder exists would return true if there was a file of the same name. I have replaced it with a function from win32 API that does the job. Now all that the problems are figured out, and the project is heading to completion. (There is still the website and more documentation to go.) I can look back and say that I learnt a lot from this project. I learnt how to use argtable, Lessard's registry class. I also now know how to get the system command to do what I want it to. Since this was written I have also learnt how to use libini. Since the last time this was updated, I have learnt how to properly use imagemagick, thanks to Anthony Thyssen and his great site. 5. Where to next: Add a command line function to name the thumbnail directory. (This could get confusing if you use '..' or '.') A Linux port, I don't have access to my uni Linux account until at least the 15th of Feb, so that isn't going to happen till at least then. The code base could use some more documentation. Look at making it pause at the end of running if the help message triggers because there was nothing on the command line, making it so people can double click on the program and see the output. Add this project to Source Forge so that people might come across and use it. Just on my site, even if it is in search engines, only people I know will see it. Add the ability to process a comment file, it means adding another program that sets up a text file ready for commenting. It’s just a thought really. Split the code for gallery.exe into seperate files, cause main.cpp is just too big. (1236 lines at this point) 6. /me waves at: (in alphabetical order) Ani, Berko, Chris, Gerald, Hex, Jin, Liz, Mellissa, Sean, Shuthdar 7. Final Words: I really do hope that someone finds this program useful. I imagine that people will use this to create a gallery that is suitable for uploading to one of the free web hosting places. Geocities and things like that. I really did have fun making it, and all the hassles made the job harder, but it also made the job satisfaction so much nummier. Oh well, all good things must come to an end, and I will stop stroking my ego. - Anthony "Timmy" Cassidy 8. Licence: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA