Home

codebutler edited this page Sep 13, 2010 · 12 revisions
Clone this wiki locally

QuickThumbs

QuickThumbs is an image gallery that generates it’s self automatically based on
files on your drive – there is no database to maintain.

Technical Overview

QuickThumbs is implemented as an HttpModule. This allows us to
intercept requests for directory listings and images and override them with our
pretty gallery pages.

In apache we use SetHandler Mono in a .htaccess file
to tell apache to forward all requests to mono (More information).
Mono then sees that we have specified an HttpHandler (in web.config) and pushes
the request off to it.

QuickThumbs is an ASP.NET 1.x application. The ASP.NET 2.0 API is not used.

QuickThumbs with Apache/mod_mono

Installation

  1. Install dependencies
You need libWand from ImageMagick, and libexif for exif support:
$ sudo apt-get install libmagick9 libexif12
  1. Get the code
The code is stored in a Git repository. Create a local copy of the repository using the following command: $ git clone git://github.com/FireRabbit/quickthumbs.git
  1. Compile
Type make from inside the src directory.
$ cd quickthumbs
$ cd src
$ make
The compiled files will be placed in the web directory.
  1. Test
You can use the XSP web server to quickly test that QuickThumbs is working properly.
$ sudo apt-get install mono-xsp
Stick some images in the ‘web’ directory and run ‘xsp’ from within there.
$ cd ../web
$ xsp
Listening on port: 8080
Listening on address: 0.0.0.0
Root directory: /home/eric/sources/quickthumbs—mainline/web
Hit Return to stop the server.
Then point your browser to http://127.0.0.1:8080 and make sure all looks good before moving on to setting up apache.
  1. Set up your apache website
QuickThumbs is an ASP.net application and requires mod_mono to work under apache. You can find more information about how to use ModMono here: Once mod_mono is installed and working (you can check the apache log to make sure it is being loaded), copy everything in the ‘web’ directory to somewhere on your web server, say /var/www/mysite/images/. Be sure to include any dot/hidden files.
$ cp -a ../web/* /var/www/mysite/images/
You will need to fix permissions (Replace www-data with whatever user your webserver runs as):
$ sudo chown www-data /var/www/mysite/images/bin/data
You now need to configure this directory as a mono application root. The man page for xsp explains how to do this, but in a nutshell, there are two ways to do this. You can either add a line to your apache configuration:
MonoApplications "/images/photos:/var/www/mysite/images/
Or, preferably, create a .webapp file in the appropriate directory. In Ubuntu, this directory is /etc/mono-server/. For example, I have the following in /etc/mono-server/eric-quickthumbs.webap:


                  Eric’s QuickThumbs Gallery
                  /images
                  /var/www/eric.extremeboredom.net/images
                  eric.extremeboredom.net


Again, the xsp man page and the URLs above explain all this in detail.
$ man xsp
Once everything is configured, restart apache and browse to the directory using your web browser.
$ sudo /etc/init.d/apache2 restart
Note that it might take a while to load each directory the first time because it has to generate thumbnails and gather metadata.

Troubleshooting

Here are some general suggestions to troubleshoot problems with QuickThumbs:

Check Permissions

Make sure that the user your webserver runs as has write-access to the
bin/data directory.


$ cd /var/www/eric.extremeboredom.net/images/
$ sudo chown -R www-data bin/

(Replace www-data with the username apache runs as on your system.)

Enable QuickThumbs Debugging

You can add &debug=yes to the end of a URL to have QuickThumbs display the
debug log at the bottom of the page.

Enabling Mono Debugging

You can add the following line to your apache configuration to have apache
execute mono in debug mode.

  MonoDebug True

With this enabled, in the event of an error mono will be able to show the line
number that it occurred on in the error output, which makes it much easier to
debug. Please always do this before contacting me.

You will need to restart apache after modifying the configuration.