mod_coolphoto is an Apache module that enables you to manage and display images within a series of photo galleries. It has been written and tested using Linux and Apache 1.3x. Each virtual server on the machine can have its own configuration and its own unique galleries.

Compilation and Installation


The only way I've attempted to build mod_coolphoto is via a statically linked module, so this is what is described below. It can probably be compiled as a DSO with minimal extra effort. Before we get started, you need to have the following:

Now that you have all the prerequisite software, the following instructions will build mod_coolphoto:

  1. Make a new directory at "$(APACHE_DIR)/src/modules/coolphoto/", and untar the mod_coolphoto distribution into it.
  2. In whatever mechanism appropriate for your shell, set the following environment variables (where the strings $(IMAGEMAGICK_DIR) and $(MM_DIR) are replaced by the directory names you installed the various packages into, as described above):
    • INCLUDES "-I$(IMAGEMAGICK_DIR) -I$(MM_DIR)"
    • LDFLAGS "-L$(IMAGEMAGICK_DIR)/magick/.libs -L$(MM_DIR)/.libs"
    • LIBS "-lMagick -lmm -lz -ltiff -lpng -lbz2 -lfreetype"
  3. Run the "$(APACHE_DIR)/configure" script. Use whatever other options you would normally use (as described in detail in the $(APACHE_DIR)/INSTALL document), but adding this option: "--activate-module=src/modules/coolphoto/libcoolphoto.a"
  4. run "make", and "make install" as described in the $(APACHE_DIR)/INSTALL document.

Configuration


Besides the proprietary coolphoto configuration directives listed below, the only other httpd.conf configuration required is to add appropriate SetHandler directives in order for mod_coolphoto to execute.

mod_coolphoto is interfaced using two modes: Normal mode and Administrative mode. Normal mode is the way casual users view your photo galleries; they can navigate through all the galleries, as well as the images within those galleries. Administrative mode is reserved for the administrator of the photo galleries; within this mode images can be imported, moved around, resized or flipped, and deleted. Due to this fact, Administrative mode should be password protected. The apache handlers for Normal and Administrative modes are "cool-photo" and "cool-photo-admin", respectively.

The following entry into httpd.conf (usable at the global server or virtual server level) will set the url for normal viewing of mod_coolphoto as "http://servername.com/photos":

<Location /photos>
    SetHandler cool-photo
</Location>
Likewise, the following entry into httpd.conf will set the url for the administrative interface of mod_coolphoto as "http://servername.com/photoadmin", using Basic Authentication and requiring the user be authenticated as a member of the "photo-admin" group (for more information, see the documentation for the AuthType directive):

<Location /photoadmin>
    SetHandler cool-photo-admin
    AuthName   "Photo Administration"
    AuthType   Basic
    Require    group photo-admin
</Location>
Besides this apache handler configuration, the only other required directives are coolphoto_enable, coolphoto_config, and coolphoto_depot (configurable at the global server or virtual server level). All other directives are optional.


Configuration Directives


coolphoto_enable

Syntax:coolphoto_enable On | Off
Default:Off
Context:server config, virtual host
Override:Not applicable
Status:Custom
Module:mod_coolphoto
Compatibility:No compatibility issues

This directive specifies whether or not cool-photo is enabled for this virtual server.


coolphoto_config

Syntax:coolphoto_config file-path
Default:None
Context:server config, virtual host
Override:Not applicable
Status:Custom
Module:mod_coolphoto
Compatibility:No compatibility issues

This directive specifies the filename used to read/store the configuration records for the set of photo galleries on this virtual server. This file-path should be an absolute path on the filesystem (for example, "/etc/httpd/conf/coolphoto.conf"), or if it is given as relative (for example, "conf/coolphoto.conf"), it will be found relative to the ServerRoot. If this file does not currently exist, it will be created automatically.

It should be noted that for all virtual servers with identical coolphoto_config and coolphoto_depot settings, the same in-memory database will be used.


coolphoto_depot

Syntax:coolphoto_depot directory-path
Default:None
Context:server config, virtual host
Override:Not applicable
Status:Custom
Module:mod_coolphoto
Compatibility:No compatibility issues

This directive specifies the directory in which converted image files will be permanently stored (when images are imported into coolphoto, they are stored into the appropriate "depot" directory). The directory-path should be an absolute path on the filesystem (for example, "/home/httpd/pics"), or if it is given as relative (for example, "pics"), it will be found relative to the ServerRoot.

It should be noted that for all virtual servers with identical coolphoto_config and coolphoto_depot settings, the same in-memory database will be used.


coolphoto_cache

Syntax:coolphoto_cache directory-path
Default:None
Context:server config, virtual host
Override:Not applicable
Status:Custom
Module:mod_coolphoto
Compatibility:No compatibility issues

This directive specifies the directory in which converted image files will be cached between requests. When building thumbnails, or when images are set to be resized before displaying to the user, coolphoto needs to take the original image, scale it to create a new image, and then return this new image to the client. In order to speed things up, these intermediate images can be cached, so the second person requesting a resized image will not have to wait for the image manipulation code to produce the intermediate image; it can be read immediately from the cache. The directory-path should be an absolute path on the filesystem (for example, "/home/httpd/pics-cache"), or if it is given as relative (for example, "pics-cache"), it will be found relative to the ServerRoot.


coolphoto_header

Syntax:coolphoto_header file-path
Default:None
Context:server config, virtual host
Override:Not applicable
Status:Custom
Module:mod_coolphoto
Compatibility:No compatibility issues

This directive specifies an html file whose content is used as the header for all the cool-photo pages in this virtual server. Common uses for this directive include adding icons or graphics to personalize the page for the overall web site, or simply using the <body> tag to specify new colors for the page.

At a bare minimum, an appropriate header file should include the opening <html> tag, the complete <head> section (including the <title> tag), and the opening <body> tag. Without using a header file, the default behavior is to have a black page with white text, and a title of "Photo Gallery".

The file-path should be an absolute path on the filesystem (for example, "/home/httpd/header.html"), or if it is given as relative (for example, "header.html"), it will be found relative to the DocRoot of this virtual server. The special value of "none" would turn off a header file on this virtual server.


coolphoto_footer

Syntax:coolphoto_footer file-path
Default:None
Context:server config, virtual host
Override:Not applicable
Status:Custom
Module:mod_coolphoto
Compatibility:No compatibility issues

This directive specifies an html file whose content is used as the footer for all the cool-photo pages in this virtual server. Common uses for this include adding icons or graphics to personalize the page for the overall web site.

At a bare minimum, an appropriate footer file should include the closing <body> tag and the closing <html> tag. Without using a footer file, the default behavior is to have no footer.

The file-path should be an absolute path on the filesystem (for example, "/home/httpd/footer.html"), or if it is given as relative (for example, "footer.html"), it will be found relative to the DocRoot of this virtual server. The special value of "none" would disable a footer file on this virtual server.


coolphoto_icon

Syntax:coolphoto_icon icon-type file-path
Default:None
Context:server config, virtual host
Override:Not applicable
Status:Custom
Module:mod_coolphoto
Compatibility:No compatibility issues

In many places within the cool-photo interface, buttons are used to move from page to page. This directive specifies a graphics file whose content is used in place of the browser's default "form" button.

The file-path should be an absolute path on the filesystem (for example, "/home/httpd/button.jpg"), or if it is given as relative (for example, "button.jpg"), it will be found relative to the DocRoot of this virtual server. The special value of "none" would disable that icon type on this virtual server.

The various icon-types that can be configured with this directive include:

bulletThe bullet used in the main page listing all the galleries
slideshowThe button used to jump to the slideshow of the gallery
thumbnailThe button used to jump to the thumbnail view of the gallery
galleryThe button used to jump back to the main page listing the galleries
nextThe button used to jump to the next picture within the gallery
prevThe button used to jump to the previous picture within the gallery
next_disThe disabled button placed where the "next" button is when there is no "next" picture
prev_disThe disabled button placed where the "previous" button is when there is no "previous" picture
editThe button used to edit a gallery (used in administration mode)
saveThe button used to save an edited gallery (used in administration mode)
cancelThe button used to cancel changes to an edited gallery (used in administration mode)
deleteThe button used to delete a gallery (used in administration mode)
continueThe "continue" button used in many places.
rotatecThe "rotate clockwise" button (used when editing images in administration mode)
rotateccThe "rotate counter-clockwise" button (used when editing images in administration mode)
scaleThe "scale" button (used when editing images in administration mode)
trashThe "empty trash" button (used in administration mode)
newgalleryThe button used to create new galleries
jumptoThe "jump to" button used to jump to random pictures within a gallery
movetoposThe "move to position" button (used in administration mode when rearranging the order of galleries of pictures)
movetogalThe "move to gallery" button (used in administration mode when moving pictures from one gallery to another)
savediskThe "save to disk" button which saves all changes to the cool-photo configuraion to the appropriate configuration file (as specified in the coolphoto_config directive)
importThe "import" button used to import new images to cool-photo

Sample httpd.conf Configuration



#
# Sample httpd.conf Configuration for a simple setup with two virtual servers
#

#
# Global Server Configuration
#

#
# Handlers: all the virtual servers on this machine will use /photos and /photoadmin as the path
#   to the coolphoto interfaces, unless they override it in the virtual server config.
#
<Location /photos>
    SetHandler cool-photo
</Location>

<Location /photoadmin>
    SetHandler cool-photo-admin
    AuthName   "Photo Administration"
    AuthType   Basic
    Require    group photo-admin
</Location>

#
# Icons: all the virtual servers on this machine will use the graphics placed in the /home/httpd/buttons
#   directory, unless overridden in the virtual server config.
#
coolphoto_icon  bullet /home/httpd/buttons/bullit.jpg
coolphoto_icon  slideshow /home/httpd/buttons/button.slideshow.jpg
coolphoto_icon  thumbnail /home/httpd/buttons/button.thumbnails.jpg
coolphoto_icon  gallery /home/httpd/buttons/button.gallery.jpg
coolphoto_icon  next /home/httpd/buttons/button.next.jpg
coolphoto_icon  prev /home/httpd/buttons/button.prev.jpg
coolphoto_icon  next_dis /home/httpd/buttons/button.nextdisabled.jpg
coolphoto_icon  prev_dis /home/httpd/buttons/button.prevdisabled.jpg
coolphoto_icon  edit /home/httpd/buttons/button.edit.jpg
coolphoto_icon  save /home/httpd/buttons/button.save.jpg
coolphoto_icon  cancel /home/httpd/buttons/button.cancel.jpg
coolphoto_icon  delete /home/httpd/buttons/button.delete.jpg
coolphoto_icon  continue /home/httpd/buttons/button.continue.jpg
coolphoto_icon  rotatec /home/httpd/buttons/button.rotateclock.jpg
coolphoto_icon  rotatecc /home/httpd/buttons/button.rotatecounter.jpg
coolphoto_icon  scale /home/httpd/buttons/button.changescale.jpg
coolphoto_icon  trash /home/httpd/buttons/button.emptytrash.jpg
coolphoto_icon  newgallery /home/httpd/buttons/button.newgallery.jpg
coolphoto_icon  jumpto /home/httpd/buttons/button.jumpto.jpg
coolphoto_icon  movetopos /home/httpd/buttons/button.movetopos.jpg
coolphoto_icon  movetogal /home/httpd/buttons/button.movetogal.jpg
coolphoto_icon  savedisk /home/httpd/buttons/button.savetodisk.jpg
coolphoto_icon  import /home/httpd/buttons/button.import.jpg

#
# Virtual Servers: in this example, we have two virtual servers using name based demultiplexing.
#
NameVirtualHost 63.197.78.158:80
<VirtualHost 63.197.78.158:80>
    ServerName                  www.coolguybri.com
    ServerAdmin                 brian@connolly.net
    DocumentRoot                /home/httpd/www.coolguybri.com
    ErrorLog                    logs/www.coolguybri.com-error_log
    CustomLog                   logs/www.coolguybri.com-access_log common
    # Here's an example of specifying the config file and depot directory for this virtual server.
    coolphoto_enable		On
    coolphoto_config            conf/coolphoto.coolguybri.conf
    coolphoto_depot             /home/httpd/pics/
    coolphoto_cache             /home/httpd/pics-cache/
    # Here we specify the header and footer files, which are relative to the DocRoot (set above in DocumentRoot).
    #  Therefore, these files are /home/httpd/www.coolguybri.com/photo.header.html and /home/httpd/www.coolguybri.com/photo.footer.html.
    coolphoto_header            photo.header.html
    coolphoto_footer            photo.footer.html
</VirtualHost>

<VirtualHost 63.197.78.158:80>
    ServerName                  www.coolbri.com
    ServerAdmin                 brian@connolly.net
    DocumentRoot                /home/httpd/www.coolbri.com
    ErrorLog                    logs/www.coolbri.com-error_log
    CustomLog                   logs/www.coolbri.com-access_log common
    # Setting the config file and depot directory. Note there is no headers and footers in this virtual servers.
    coolphoto_enable		On
    coolphoto_config            conf/coolphoto.coolbri.conf
    coolphoto_depot             /home/httpd/pics/
    coolphoto_cache             /home/httpd/pics-cache/
    # Here, we have decided to override the icons set in the global spec so that this virtual server has no bullets.
    coolphoto_icon              bullet none
</VirtualHost>


Distribution


mod_coolphoto.2.0.tar.gzmod_coolphoto 2.0. November 1, 2002
mod_coolphoto.buttons.tar.gzSample buttons to use