IMGSVR MANUAL Version 0.6.21

Next: , Previous: (dir), Up: (dir)

Next: , Previous: Top, Up: Top

1 Introduction

ImgSvr is a native cross platform Picture Web Server. This server has been build to easily share and manage pictures over the Net (over internet, a local network, or a standalone computer).

1.1 Main Features

ImgSvr is fully dynamic, no HTML pages or thumbnails pictures to manage in the picture folders or sub folders.

ImgSvr provide a smart browsing with it's inheritable skins feature. Just copy skin file in the folder you wish .. then all sub folders will inherit the layout.Then , it really easy to publish new pictures -> just put them on a published folder.

Thank's to the Imgsvr's “mount like” capability, you can have a unified picture catalog browsing from different picture file folders or database stored pictures. It is possible to use different picture source to build your own picture catalog or gallery. This also permit to divide storage capability and easily have huge picture catalogs.

Imgsvr has a thumbnail generation that speed up the image browsing and save bandwidth (instead of sending the hole full resolution image on the network). Thumnails are stored in gdbm files depending on the thumbnail size. Thumbnails can be created :

1.2 Why Yet An Other Image tools

There are a lot of tools on the web to let you publish pictures, so Why an other image tools ... ?

Imgsvr is quite different, as it is fully dynamic no maintenance have to be done to publish pictures. As the pictures are downloaded from the camera and classified on the hard drive or CDROM, then it is served and published.

Also, i didn't want to duplicate the huge amont of picture i had on my computer. (over 15 Giga)

I didn't want to send my private pictures on a remote server

I want to keep track of people that are watching the picture and use the pictures

Imgsvr permit have a Direct to the web capability, without having anything special to do.

Imgsvr is very useful for me.

1.3 Implementation

ImgSvr has mostly been written in Ada for language advantages

1.4 Thanks

Many thanks to P. Obry and D. Anisimkov for their famous web tools (AWS). thank's to d. Marceau for his suggestions to improve imgsvr.

Next: , Previous: Introduction, Up: Top

2 Install

2.1 Installing

2.1.1 on Linux Box

Extract all files in a folder, grant the execute permission to binary files. Imgsvr can also be run as daemon to provide a standard service. (please refers to your linux distribution manual).

Needed libraries are provided in the tarball.

2.1.2 on Windows

An Installation program is available for windows platforms since 0.6. Run the setup installation program and follow the wizard. the installation program will setup a windows service for Imsgvr, on port 1235 and serve images located in installation setup directory. ( typically in program files folder ..)

It is possible to do a custom install, in copying binaries, and registering by hand the service under windows. This custom install can be done in using the imgsvr_control command line. (imgsvr-control -i command will register the new service).

     Usage: ImgSvr_control [-iu]
            -i  : install service
            -u  : uninstall service
            -s  : start the service
            -t  : stop the service
       for All options, -n specified the servicename
     for example to register an other Imgsvr service use this command :
         imgsvr_control -i -n "An other Imgsvr Service"

2.2 Dependencies

2.2.1 Requirements installing ImgSvr on a linux box

ImgSvr use all those libraries / components :

Thoses librairies are often present in standard linux distribution. The binary version of imgsvr for linux plateforms include thoses libraries (statically linked libraries).

2.2.2 Requirements installing / Using ImgSvr on Windows

All dependencies has been included in the Zip (Jpeg.dll, SSL Dependencies) These DLL could be kept in the same directory or placed in the Windows System path.

2.3 Custom Install

You can separate program and content, in providing a imgsvr.xml configuration file.

Next: , Previous: Introduction, Up: Top

3 Running

To run ImgSvr, launch the executable. The console must print the server is listening on a port ..

Remember the port, launch a Web Browser and go to the URL : http://<your machine name>:<the printed port on the console>/

by default, listening port is 1235, but it can be override in the configuration file.

3.1 Running on Linux as a daemon

New to version 0.6.18, there is an imgsvrd executable that permit executing imgsvr as a daemon. This executable can take two options in running :

To execute imgsvr as a deamon, launch the following command line :

nohup imgsvrd [ option ] &

the executable will still remain and running if you close the console.

3.2 Building a specific configuration file

The configuration file is named imgsvr.xml and is an xml file. (please refers to the w3c for informations about xml).

This XML define the configuration of imgsvr. specifically the mounted catalogs of imgsvr.

in this xml you will find several informations :

3.2.1 SERVER entity

The SERVER entity is the most important, it can overried the listening port , and the main rootpoint used for the templates and file finding.

3.2.2 FILECATALOG entity

This entity define a jpg file based catalog. this catalog store thumbnails in a GDBM file stored in the main folder (the one defined by the root attribute). root attribute define the physical main folder for the webfolder defined by the mounted point attribute.

3.2.3 SECURITY entity

Specify the user authentification facilities. When a Security element is present in the config file, the name and password of authorized people. You can have several USER element depending on the number of users.

     		<USER name="guest" password="guest" allow="^/$,^/2007.*" />

this example allow a user “guest” to connect to the server with the password “guest”. the guest user is allowed to browse the root, and all 2007 root folders and images ...

3.2.4 DBCATALOG entity

unavailable on current ImgSvr version (0.6.10)

This section declare a catalog stored in a mysql database. Mounted point match the catalog in the URL.

3.3 minimal Imgsvr.xml Example

     <?xml version="1.0"?>
     <SERVER port="1235" rootpoint="./">
     	<FILECATALOG root="/home/use/.root/html/" mountedpoint="/xx" />
     	<FILECATALOG root="./" mountedpoint="/" />

here is an config file example showing an utilization of two separated folders.

In this example, all templates will be found in the ./ directory (this is defined by the rootpoint's SERVER attribute).

Next: , Previous: Running, Up: Top

4 Using Database Storage

thoses functionnalities has been desactivated since 0.7 version, as this is not a principal goal, i wanted to focus on the file base functionnalities

You can use Mysql Database to store your pictures. The dbimport utility lets you import pictures in the database.

4.1 Mysql Schema Model

Imgsvr Server needs two tables to store images.

to create the structure, you can use the script below :

     create table dirs ( id int(11) not null auto_increment,
     		    name varchar(100) default null,
     		    par int(11) default NULL,
     		    key id (id));
     create table imgs ( name varchar(100) default NULL,
     		    id int(11) not null auto_increment,
     		    thumbnail mediumblob,
     		    img mediumblob,
     		    parent int(11) unsigned not null default '0',
     		    unique key id (id),
     		    key parent (parent),
     		    key name (name,parent));

4.2 importing pictures

To import pictures in database, use dbimport utility. this command line import all images contained in the current directory and subdirectories into the database.

dbimport format : dbimport [options] [destination catalog root]

options :

all options are required.

Example, import current directory in the root catalog (/) in a database named “atelier” on the same computer

        dbimport -s localhost -u root -d atelier /

Next: , Previous: Using Mysql Database, Up: Top

5 Customizing Layouts

5.1 Introduction

Imgsvr has its own skin inheritance mechanism. Files asked throw the web are searched recursively to the parent (from the root point path given in the configuration file) until it is found. If Files are not found, default files embedded in the binary will be used.

This permit to define a layout for all the sub directories, without having to rebuild static HTML files. Changing directory layout is althought very easy, just change the root key files.

Let's discuss how it works : When browsing an image directory, ImgSvr first look for a index.tpl file, which define the appearance of the browsing part. The Template provided are HTML pages with specifics tags for directories entries and image names.

The tpl files are Template Parser conformant (Aws Feature), and it is very easy to construct, there is only keywords that defines the images files (For more informations, please refer to the AWS documentation). Template Parser offers a lots of feature for rendering, expression evaluating, breifely all needed for creating high quality pages.

To use a skin provided in the current distribution, just set the skin path in the rootpoint attribute in the configuration file.

5.2 Creating a browsing template file

A browsing file is always named index.tpl, and have several keywords to place Sub folders in the page and images references.


Here is an example of a first index.tpl :

     <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
       <title>Image Browsing</title>
     <link href="image.css" type="text/css" media="screen" rel="StyleSheet">
     <body background="fleur.png">
     <h1 align="center">Pictures</h1>
     <p><a class="link" href="../">Up</a></p>
       @@TABLE@@     <tr>
       <td><a class="directory" href="@_DIRS_@/">@_DIRS_@</a></td>
     <table cellpadding="2" cellspacing="2" border="0" width="100%">
           <td valign="top">
     <a class="thumbnail" href="@_IMAGES_@?template=image.tpl"><img class="thumbnail" src="@_IMAGES_@?size=small"></a>

Previous: Customizing Layouts, Up: Customizing Layouts

6 Internationalization, Localization

6.1 i18n

Localisation of the web site is simple, it act as customizing the default template, to use an other language. Then when installing the software, you will find a skin directory containing a default sub directory. This “default” directory contains all the pages use for a default browsing of the website. So to translate it you must change the HTML visible strings into your language. a french translation is given for an example.

Next: , Previous: Customizing Layouts, Up: Top

7 Compilation

this chapter describe how to compile imgsvr.

First you will need GNAT compiler, an excellent Ada compiler at

you will have to get all dependencies followed :

Next: , Previous: Compilation, Up: Top

8 Using Imgsvr from a CD

Imgsvr can be used directly from a CD. As for installation, just copy the Imgsvr binaries in the CDROM root, put all the pictures on it, and then launch imgsvr binary and a browser to see the result.

It is possible for Windows CD to have a autorun capability to automatically let the user browse the gallery.

Create a autorun.inf text file at the CDROM root directory with this content


this file will ask windows to run the following script named “autorun.bat”

     @echo starting ImgSvr ...
     @start imgsvr.exe

this script will launch imgsvr.exe with all default options, and launch the web browser pointing to the local machine with defaut port(1234).

thanks to Thomas, for this exciting tip !

Next: , Previous: Using Imgsvr from a CD, Up: Top

9 Security

A first security system has been made to permit only authorized users to browse the pictures. This function use the http authentification method.

To secure the web server, insert a SECURITY element in the imgsvr.xml, as described in the sample_imgsvr.xml in the distribution.

Previous: Security, Up: Top

10 Developper


Imgsvr can be used as a standalone final web server or as an image server in the infrastructure. Here is the usage of the API designed for more convenient use. An HTTP API has been put in place to permit getting a list of subfolders and images. Images can also be download and resized throught this API.

10.1.1 Getting a folder sub list and image list

a text API is in place to permit a program to explore the folders and image lists. This API is accessible in using API in the URL.

for example

     Getting the root sub folder list and image list.
     Getting the 2000-06-08_Demenagement sub folders and image list

imgsvr respond a 2 lines text stream with the following format

DIRS:{pipe separated sub folders list} IMGS:{pipe separated image name list}


10.1.2 Getting an image

Getting an image stream containing the image is very simple, the URL given is the URL or the image

     Getting the image Photo_100-6-8-25.jpg of the subfolder 2000-06-08_Demenagement :

10.1.3 Getting an image with resizing

when getting an image it is possible to resize it “on the fly” by giving a “size” HTTP parameter containing a pixel number wished.

     getting an image with 4000 pixels

using this command, the aspect ratio is preserved. This operation can be long depending on the sized asked and if the cache cannot operate.

10.2 Using Cache

For several sizes used in templates it is interesting to cache images with specific size , in order to not recompute then at each request. (request time can move from 4s to 0.004 s using the cache). So for heavy sites, it is important to specify correctly the thumbnail sizes of the images used in templates.

10.2.1 How to configure the cache

The thumbnail cache is by default activated with several sizes. Thoses sizes can be overrides usign the scales attribute in the XML config file (on the SERVER element).

The thumbnail cache is also active by default, ie the imgsvr will browse and actively build the thumbnails if thoses are not existing. This behaviour can be superceeded by setting to false the prefetch_thumbnails attribute in the config file.

Concept Index

Table of Contents