Click here to Skip to main content
15,881,139 members
Articles / Web Development / HTML
Article

Electronic photo album in HTML HELP

Rate me:
Please Sign up or sign in to vote.
4.91/5 (7 votes)
13 Nov 20026 min read 235.4K   4.2K   69   43
A complete electronic photo album in an HTML Help (.CHM) file with a front page, index, slide show and legend/about page.

Image 1   Image 2

Image 3   Image 4

Contents

  • Introduction
  • Features
  • What is HTML Help?
  • Installing HTML Help workshop
  • Creating your own photo album
  • The album source files
  • encode.bat and srcenc.exevv

Introduction

Finally some fun with HTML Help! This little project demonstrates that you can do more with HTML Help than online help... The screenshots above shows the demo album, implemented using Microsoft's HTML Help. In just one CHM file, you can distribute a complete photo album with your photos.

When I bought my first digital camera in 1999, I needed a decent way to distribute my photos in an album like manner. With this electronic photo album you yourself can easily construct your own album using your own photos and give the album to your family and friends. Anyone running Windows and Internet Explorer 4 (or later) can easily view it. The album in the source code download contains all the logic, just add water, eh, photos.

The demo album is composed of photos that I shot during TechEd 2001 (Barcelona), my 2001 vacation trip in South Africa and some pictures from an "I-am-not-in-my-right-state-of-mind" website of mine (webknuffels.nl).

Features

  • fixed size window with an image of an photo frame, designed for at least an 800 by 600 screen,
  • a little 'control panel' on each page: go to front page, go to index page, do slide show and go to legend page.
  • a front page or title page (with for example a composition of some of the photos),
  • an automatic index page of the photos in the album,
  • show a particular photo with a click on the index page,
  • slide show all photos,
  • a legend/about page,
  • previous/next photo arrows,
  • very easy to construct your own album: prepare your photos (JPGs), register every JPG in photos.js, make up a title for each photo, compile and presto! (Well, almost).

This article is mostly about how you can use the album with your own photos and not how the album is technically constructed. If you're interested, take a look at the internals of the album in the HTML pages and in the .js files. I can be persuaded to do an article about the technical part... Some of the technical features:

  • Passing parameters to another page inside the CHM using bookmark ("#") notation in the URL, instead of not-working search ("?") notation! Now information can be passed from one page to another, like the last viewed photo so any page change can react appropriately to it.
  • Prepared for encoding the scripts (see "encode.bat and srcenc.exevv" later) to prevent tampering to the album.
  • Buffered image loading to overcome an IE4 image resizing DHTML 'bug'.

What is HTML Help?

Microsoft HTML Help is the successor to WinHelp and is used for Windows Help systems since Internet Explorer 4 and Windows 2000. The HTML Help files typically use the .CHM extension and consists of several HTML files, JPG/GIF images and scripts. A CHM file is actually like a complete website compressed into one file: 'CHM' is short for 'Compiled HTML' . Additionally, with a table of contents, index and full text search, a complete help system is created.

Using the HTML Help compiler (see later) from the Microsoft's HTML Help workshop, the album's files are compiled into a single .CHM file. This album in particular uses 4 HTML files, several GIFs and the photo JPGs to make up the album.chm. We're not going to use the HTML Help contents, index and full text search tab with the HTML Help photo album.

Installing HTML Help workshop

To compile the files into the .CHM file, you'll need to install Microsoft's HTML Help Workshop, which contains the compiler. Download the workshop using the link above and install it.

Creating your own photo album

Image 5In just 6 steps you construct your own album using the album source code (which you can download through the link at the top of this article):
  1. Extract the album source from the source zip file into a folder of your choosing and delete all the (demo) JPG files in the "photos400x300" folder. I've summed up the files further below.

  2. Select the photos you want in the album, resize them to at most 300 pixels high and at most 450 pixels wide using a image editor like PhotoShop or PaintShop Pro and save the files into the "photos400x300" folder.

  3. Next we need to create the photo for the start page of the album; it's called composition.jpg and must be saved in the "photos400x300" folder. I usually create a composition from some of the photos (hence the name) and add some text like the album's title. I find the composition for the demo album fairly successful.

  4. Edit photos.js to 'register' your photos: 
    • Replace the registration of the demo photos with your own at
      // Define the photos.
      aPhotos = new Array(
      	//"Filename", "Caption",
       	"yourphoto1.jpg", "Title of photo 1",
       	"yourphoto2.jpg", "Title of photo 2",
      	"yourphoto3.jpg", "Title of photo 3"  // NO COMMA at the last entry!
              }
    • For every photo, store a filename-title pair:
      "yourphoto1.jpg",
          "Title of photo 1",
      making up a JavaScript array of these pairs. Note that you have to use a comma's between and after the pair, but leave out the trailing comma after the last pair or a syntax error is yours! 

  5. Edit album.hhp (HTML Help compiler project file) to change the compilation output and album title:
    • Change "Compiled file" (the name of the resulting .CHM file), from
        Compiled file=victorsdemoalbum.chm
      to something like
        Compiled file=vacation2001.chm
    • Change the album's title by changing "
      Victor's demo photo
              album"
      in
      [WINDOWS]
      main="Victor's demo photo album",,,,,,,,,,,0x0,[16,0,717,560],0x0,0x0,,0,0,0,0
      to something like
      [WINDOWS]
      main="Vacation 2001",,,,,,,,,,,0x0,[16,0,717,560],0x0,0x0,,0,0,0,0
  6. Start the Microsoft HTML Help Workshop and open album's HTML Help project file album.hhp. Choose File | Compile and let the Workshop compile the album. Presto! That's it! The album is created!

    Image 6

The album source files

These are the files in the album:

photos400x300\ folder that holds the photos and composition.jpg
images\ album images
start.htm Start page of the album
thumbpic.htm Index/thumbnail page of the album
pic.htm normal pic/slideshow page
about.htm About/Legend page
album.css album's style sheet
album.js Album's JavaScript code
lang.js Tooltip texts
langen.js Tooltip texts English (copy over lang.js)
langnl.js Tooltip texts Dutch (copy over lang.js)
photos.js Registration of the photos
Album.hhp HTML Help project file
encode.bat Encoding the album's scripts
SCRENC.EXEVV Microsoft script encoder

encode.bat and srcenc.exevv

encode.bat is just an easy calling mechanism for encoding the scripts (HTML and .JS files) in the album using the Microsoft Script Encoder SRCENC.EXE. Now only Internet Explorer (actually: the Microsoft Scripting Engines) can decode and understand the scripting. It's a convenient method to protect the album from tampering: the scripts are no longer human readable!

The idea is to encode the scripts just before you compile the files into the .CHM (step 6 above).

Now why did I add the two 'V's to the script encoder's filename? Because encoding is pretty irreversible and you better do the encoding process on a copy of the album folder! When you've copied the album, remove the double 'V's from the encoder's filename and execute encode.bat to encode the album's files. Then perform step 6 of "Creating your own album".

Example from an encoded photos.js:

//**Start Encode**#@~^OwcAAA==@#@&@#@&Jz,Ktb/,Wk^+~mKxOCbx/,CV^PY4n~w4WDWdPCU9P^
laOkKxd~K0@#@&&JPOtbd,wCMYbmE^lM~l^4;:c@#@&@#@&zz,j+DPY4n~w4WDW~Nr.mOWMz@#@&/P4
!:4UCbVjk.nhtGDWkSW1lDrW	PxJatGOK/FZT6F*zrI@#@&kHNrEhjbynn4GYK/JG1lYrG	
P~P,xrw4KYK/cZ!Xf!ZzEi@#@&&&krDTrxmV?b"nn4WDWdSG^mYrW	~P,'E24WYGd8!+cX{+%&ri@#@&
@#@&zJ~?Y~Y4+~ObYV~W6PY4n~l^4!:@#@&d)^4;::rY^+~x,J.r^DW.Bk~9+hKPmV4!:rI@#@&@#@&
zJP9n6kx~Y4+Pa4GYK/c@#@&lK4KYG/,xP	+A~zDDCzv@#@&zJEwksxm:+r~,EZmwOkKxES@#@&JZT
...

License

This package is published under the Artistic license.

Change log

26 jan 2002 - Initial publication
20 feb 2002 - added light src download (with only two photos) and added usage license.
07 nov 2002 - Removed the dead HtmlHelp workshop exe link and clarified some things.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior)
Netherlands Netherlands
Victor is consulting in The Netherlands.

His interests include Windows and web application development using .NET technologies and even some Apache/PHP/MySQL...

Comments and Discussions

 
GeneralRe: Bigger Images Pin
Victor Vogelpoel31-Aug-04 12:18
Victor Vogelpoel31-Aug-04 12:18 
GeneralAwesome! Pin
Riaan Timmerman19-Nov-02 8:19
sussRiaan Timmerman19-Nov-02 8:19 
GeneralRe: Awesome! Pin
Victor Vogelpoel19-Nov-02 9:02
Victor Vogelpoel19-Nov-02 9:02 
QuestionHow to? Pin
Kant17-Nov-02 9:48
Kant17-Nov-02 9:48 
AnswerRe: How to? Pin
Victor Vogelpoel17-Nov-02 20:01
Victor Vogelpoel17-Nov-02 20:01 
QuestionScript Errors? Pin
Kant14-Nov-02 17:23
Kant14-Nov-02 17:23 
AnswerRe: Script Errors? Pin
Victor Vogelpoel14-Nov-02 19:59
Victor Vogelpoel14-Nov-02 19:59 
GeneralWorks now... Pin
Kant15-Nov-02 7:25
Kant15-Nov-02 7:25 
GeneralElectronic Photo Album Pin
Anonymous10-Nov-02 17:00
Anonymous10-Nov-02 17:00 
GeneralRe: Electronic Photo Album Pin
Victor Vogelpoel10-Nov-02 21:07
Victor Vogelpoel10-Nov-02 21:07 
GeneralThis rocks Pin
dreamreaver6-Aug-02 10:20
dreamreaver6-Aug-02 10:20 
GeneralBrilliant! Pin
Tom Archer7-May-02 14:15
Tom Archer7-May-02 14:15 
GeneralRe: Brilliant! Pin
Victor Vogelpoel7-May-02 22:39
Victor Vogelpoel7-May-02 22:39 
GeneralDoesn´t work in Opera :-( Pin
23-Apr-02 23:48
suss23-Apr-02 23:48 
GeneralRe: Doesn´t work in Opera :-( Pin
Victor Vogelpoel24-Apr-02 4:13
Victor Vogelpoel24-Apr-02 4:13 
Generalwow Pin
Swinefeaster4-Mar-02 16:46
Swinefeaster4-Mar-02 16:46 
GeneralRe: wow Pin
Victor Vogelpoel4-Mar-02 22:24
Victor Vogelpoel4-Mar-02 22:24 
Generalgreat idea Pin
Skutvik19-Feb-02 20:06
Skutvik19-Feb-02 20:06 
GeneralUnisys Patent Pin
6-Feb-02 3:10
suss6-Feb-02 3:10 
GeneralRe: Unisys Patent Pin
Rick York6-Feb-02 6:30
mveRick York6-Feb-02 6:30 
GeneralRe: Unisys Patent Pin
6-Feb-02 15:57
suss6-Feb-02 15:57 
GeneralRe: Unisys Patent Pin
Rick York6-Feb-02 16:37
mveRick York6-Feb-02 16:37 
GeneralRe: Unisys Patent Pin
7-Feb-02 9:41
suss7-Feb-02 9:41 
GeneralRe: Unisys Patent Pin
Rick York7-Feb-02 11:35
mveRick York7-Feb-02 11:35 
GeneralRe: Unisys Patent Pin
10-Feb-02 6:30
suss10-Feb-02 6:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.