Photogrotto has the following features.
Photogrotto is a multi-threaded application with the ability to accept and process multiple simultanious requests for photos.
Photogrotto was designed using Qt 4.2.x and ImageMagick 6.3.x. The reason for using ImageMagick instead of the Qt image manipulation classes was to allow this application to run without an X server.
A long term goal is for it is to be able to serve semi-static html content available for a given image. This will most likely be used from within an iframe.
photogrotto -f [xmlfile]
The parameter xmlfile should point to the xml file defining the servers operation.
http://<servername>[:<port>]/<image_name>.<ext>[?<options>]
The servername would be something like images.clockstop.com. The port is a number, if not specified, the browser will most likely use 80. The ext defines the format of the image to return. The server will convert the image to any supported format. The following extensions can be used for the requests:
jpg Jpeg image png Png image bmp Windows bitmap xbm X11 bitmap (black and white pixels) xpm X11 pixmapThe follwing options will be honored:
width=<n> Sets the width of the image height=<n> Sets the height of the image colors=<n|monochrome> Sets the number of colors to use in generating the image. If this is set to monochrome, the image will be black and whiteHere is an example configuration file
<configuration>
<!--
Specify the log file to send logging info to
-->
<logfile name="/var/log/photogrotto.log" />
<!--
Specifiy the IPAddress of the interface and Port number to listen on
for requests. Currently only one listen definition can be given.
-->
<listen port="8081" address="24.154.32.42" />
<!--
Start the definition of a server. Specfiy the host name which will be
passed in for the request.
-->
<server name="www.k9country.com:8081">
<!--
Specify the database name and type of database. Any valid database
type there is a plugin for can be specified here
-->
<database name="k9kinship" type="QPSQL">
<!--
Specifiy the connection information for the database.
-->
<connection host="db1.server.com" port="5432" user="myname" table="dog_pictures" />
<!--
Define the sql statement required to fetch the desired image.
Currently "raw" is the only valid format.
The tag :resource will be expanded to the requested file name
of the image. As an example, if the complete url is
http://www.k9country.com:8081/113-203.jpg?width=200
:resource will be expanded to 112-203.jpg
-->
<sql format="raw">
<![CDATA[
select dog_pictures.pic
from dog_pictures
where dog_pictures.dog || '-' || dog_pictures.ident || '.jpg' = :resource or
dog_pictures.dog || '-' || dog_pictures.ident || '.png' = :resource or
dog_pictures.dog || '-' || dog_pictures.ident || '.xpm' = :resource or
dog_pictures.dog || '-' || dog_pictures.ident || '.bmp' = :resource or
dog_pictures.dog || '-' || dog_pictures.ident || '.xbm' = :resource
]]>
</sql>
</database>
<!--
Define the maximum size of the largest size of the image to be
servered. Requests for any size larger will result in an image
with it's largest size set to max_dimension.
Cache_dimension is the size of the largest side of an image will
be scaled to when saved in the image cache.
-->
<image cache_dimension="1024" max_dimension="1024" />
</server>
<!--
Define more servers as needed
-->
<server name="images.clockstop.com:8081">
<database name="clockstop" type="QPSQL">
<connection host="db2.server.com" port="5432" user="myotheruser" table="products" />
<sql format="raw">
<![CDATA[
select pic from products where model || '.jpg' = :resource or
model || '.png' = :resource or
model || '.xpm' = :resource or
model || '.bmp' = :resource
]]>
</sql>
</database>
<image cache_dimension="1024" max_dimension="1024" />
</server>
<server name="images.diecastdepot.net:8081">
<database name="diecast" type="QPSQL">
<connection host="db1.server.com" port="5432" user="username" table="products" />
<sql format="raw">
<![CDATA[
select pic from products where model || '.jpg' = :resource or
model || '.png' = :resource or
model || '.xpm' = :resource or
model || '.bmp' = :resource
]]>
</sql>
</database>
<image cache_dimension="1024" max_dimension="1024" />
</server>
</configuration>
1.5.0