Welcome to tolink, a Haskell programm
(2011-09-06)
Hi.
If you come this far, you are about to test my only haskall program that ever made it into something productive. It's called tolink and it is really AMAZING! ;-)
I needed some program to resize a bunch of jpg files and build an according set html files to link them together. At the time, back in the early 2000s, I had a programming course in haskell (as an example in functional languages) and I though "what the frell, just try it in haskell". Could have done it in C, but hey, why do it in a simple way when you can do it in a complicated way? ;-)
It was a time when there were no or only a few free (as in "free of charge") image hosters and not every webserver supported php or other srcipts. Nowadays it might seem obsolete, but I personally still like to host my images on my own server or domains. It's just a matter of pride (and sometimes of copyright issues).
Now it is 2011 and I needed to recompile the binaries, because they stopped working. Some linking was broken. (Should have build a static bin...) ;-) I had to go way back into the backup folders on some DVDs to find the source, and while I was on it I changed some minor things. It still works in the same way it always did, so it's not very user friendly, but I like this way.
Whatever, here is what you need to run it:
(BSD, Mac or other unix-like systems might work, too, as long as there is a haskell compiler and ImageMagick available, see above.)
To run the program:
- Copy the three files (Windows: tolink.exe, conv.exe, tl.bat; Linux: tolink, conv, tl.sh) into the folder where your jpgs are
- Start the script (Windows: tl.bat; Linux: tl.sh)
After that you will have a directory called output with all your cooooool jpgs shrinked to 33% together with some nice html-files linking them all together and a second directory called output/thumbs with the same coooooool jpgs shrinked further down to 15%. (These are the standard values, easily changed on the command line.)
Compiling:
To compile you need ghc. I use version 6.12.3, others might work, I don't know. However, in Linux - after unpacking - type:
ghc --make tonlink
mv a.out tolink
ghc --make conv
mv a.out conv
(You might want to strip the binaries afterwards.)
In Windows, open a shell (cmd.exe) and change to the foler you've unpacked the source to, then type:
ghc --make tonlink
move a.out tolink
ghc --make conv
move a.out conv
Use:
Copy the executables and shell scripts to the folder with your jpgs, then execute tl.
CHANGELOG:
1.1: * minor changes
1.0: * Fixed off-by-one issue with page count
1.0a: * unified convert and convert-linux
* pictures may now be embedded into html pages
* English translation
0.9: * first release
Newest Versions always in my blog.