htimage
program in the distribution, which is an /htbin
program
handling clicks on sensitive images. For versions 2.15 and newer it
is a CGI program (uses the Common
Gateway Interface to communicate with httpd
). See demo.
htimage
installation
htimage
htimage
you should move the executable
binary to the same directory as your other server scripts are, and
remember to set up an exec rule. For example if your scripts are in
/usr/etc/cgi-bin
, you could have an Exec
rule like this:
Exec /htbin/* /usr/etc/cgi-bin/*Often
htimage
is one of the most often used scripts, and
it would therefore be nice to refer to it with as short a name as
possible, like /img
, so you could have a Map
rule just before the Exec
:
Map /img/* /htbin/htimage/* Exec /htbin/* /usr/etc/cgi-bin/*
ISMAP
in your inlined image call, and
HREF
to the script handling the request (htimage)
with
image configuration file name appended to it.
htimage
via
an image configuration file. These files are referred to by the extra path information in the URL
causing the call to htimage
:
<A HREF="/htbin/htimage/image/config/file"> <IMG SRC="Image.gif" ISMAP></A>Image configuration file can be:
htimage
will look for both of these (afterall, it gets
both PATH_INFO
and PATH_TRANSLATED
environment variables from httpd
anyway).
You can even do some very smart mappings in the rule file to allow
very short references to htimage
and picture
configuration files. Let's suppose all your image configuration files
are in directory /usr/etc/images
. Then you can use the
following two rules in your server's configuration file (by default
/etc/httpd.conf
):
Map /img/* /htbin/htimage/usr/etc/images/* Exec /htbin/* /usr/etc/cgi-bin/*In this case you can refer to your image mapper very easily; if you have an image configuration file
Dragons.conf
in
/usr/etc/images
directory, all you need to say in the
anchor is this:
<A HREF="/img/Dragons.conf"> <IMG SRC="Image.gif" ISMAP></A>
default
URL
circle
(x,y) r URL
rectangle
(x1,y1) (x2,y2) URL
polygon
(x1,y1) (x2,y2) ...
(xn,yn) URLhtimage.
So first point is added also as the last one if necessary.
def, circ, rect, poly.
Shapes are checked in the order they appear in config file, and the
URL corresponding to the first match is returned. If none match, the
default
URL is returned.
URLs are
htimage
prints a single Location:
field
to its stdout
, or an error message with preceding
Content-Type: text/html
so in fact htimage
behaves exactly as any other CGI/1.0 program (script), and is not
in any way handled specially by the server. Therefore, you can
rename htimage
to whatever you prefer, like we called it
/img
in the above example.
Server understands this Location:
field, and either
directly sends that file to the client (non-full URL), or sends a
redirection to client causing it to fetch the document, maybe even
from another machine.
Note that URLs returned by htimage
may well be other
script requests - there is no reason for being limited to just regular
documents.