Click here to Skip to main content
Click here to Skip to main content

Electronic photo album in HTML HELP

By , 13 Nov 2002
 

  

  

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

In 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!

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

About the Author

Victor Vogelpoel
Software Developer (Senior)
Netherlands Netherlands
Member
Victor is consulting in The Netherlands.

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

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Generalhello! help me i have to make project in javascriptmembernitpap9 Nov '06 - 19:46 
hello!
if u can help me contact me on nitesh4ever@yahoo.co.inSigh | :sigh:
 
nitesh

GeneralRe: hello! help me i have to make project in javascriptmemberVictor Vogelpoel9 Nov '06 - 20:49 
I don't do other people's school work...
 
VictorV

Generali'm confused!membertribeprincess29 Jun '03 - 16:39 
okay, so i made it through steps 1-6 easily enough. but now how do i get the album to my webpage?
i'm very new at this and only know basic html, so if anyone can give me fool-proof, thorough instructions, i'd be most grateful!!!
 
thanks!
 
lar
GeneralRe: i'm confused!memberVictor Vogelpoel29 Jun '03 - 21:18 
The album is not meant to be used on a website! The CHM file that steps 1-6 produces contains the photo album code and all the photos that you've added. You can distribute this CHM file to your friends and family and they can see the pictures (as long as they have Windows and Internet Explorer installed).
 
You *can* upload the CHM to your site so people can download it and view the album.
 
If you want a regular photo album on your website, there are plenty of photo-album-on-a-website examples out there...

 
VictorV
GeneralRe: i'm confused!membertribeprincess30 Jun '03 - 4:21 
oh... hmm. well thanks for the heads up!
GeneralServer Side AlbumsussOlivier HAULT4 Feb '03 - 21:55 
I wonder if this HTML HELP architecture could not also be used behind a Web Server to build a complete server side album for Internet browsers.
 
- TOC could be exported in XML and snapped into your preferred ASP.NET tree view .....
- For updates, Web pages could be written to manage upload creation of new chapters .....

 
Olivier
GeneralRe: Server Side AlbummemberVictor Vogelpoel5 Feb '03 - 0:46 
Eh, why bother creating a server-side HTML Help photo album?
 
Using ASP.Net/C#, you could create a pages similar to the thumbnail/photo page from the album; the server-side code would just scan a folder for images. Uploading is simply placing photo files into the folder.
 
You could place a album.CHM on the webserver and access it using IE; I'm not sure about the syntax anymore. http://www.keyworks.net ran its site from a CHM a few years ago (one of the keyworks founders was the lead architect for the WinHelp/HTMLHelp system).
 

 
VictorV
GeneralBigger ImagesmemberMario Simeone17 Dec '02 - 22:53 
How to and what to modify to have bigger images
GeneralRe: Bigger ImagesmemberVictor Vogelpoel17 Dec '02 - 23:20 
The album was designed for 800x600 screen sizes (which was very much used back in 1999).
 
Please note that the larges the images are, the larger the album becomes in size, which may be problematic when someone wants to download the album. With only 26 photos in the demo album, the size is already 1 MB!
 
If you want to use bigger images, then you'll have to:
- use another framing image, because the supplied one will not look good if enlarged.
- modify the html page that shows the photo to use a larger table.
- modify the index page to show more thumbnails.
- modify the hhp file to increase the width and heigth for a larger window.
 
Good luck

 
VictorV
GeneralRe: Bigger ImagesmemberMrBaseball3431 Aug '04 - 10:19 
[quote]
modify the html page that shows the photo to use a
larger table.
[/quote]
 
If you use percentages instead of sizes, you
shouldn't have to modify the HTML that much.
In fact, I bet you could make it using CSS and
never have to modify it at all.
GeneralRe: Bigger ImagesmemberVictor Vogelpoel31 Aug '04 - 12:18 
Well, you still have to do something about the 'frame' image, because it was created for 600x800. Larger images mean a larger and new frame image.
 
Victor
 
VictorV
GeneralAwesome!sussRiaan Timmerman19 Nov '02 - 8:19 
Smile | :) Great tool!
GeneralRe: Awesome!memberVictor Vogelpoel19 Nov '02 - 9:02 
*blush* thanks!
 
Your name sounds Dutch. Fellow countryman?
 
VictorV
QuestionHow to?memberKant17 Nov '02 - 9:48 
Hi,
 
How to disable the Maximize button?
 
Can you provide us with English version of "imgnotfound100x75.gif".
 
Thank you.Rose | [Rose]
 
Kant

AnswerRe: How to?memberVictor Vogelpoel17 Nov '02 - 20:01 
Kant wrote:
How to disable the Maximize button?
 
I'm not sure, but I think this can be done setting styles in the window definition for window 'main', section "[WINDOWS]" in album.hhp.
 
Kant wrote:
Can you provide us with English version of "imgnotfound100x75.gif".
 
It just says: "Photo not found", but you shouldn't need it if you provide all the photo files that you have registered in photos.js. imgnotfound100x75.gif is shown when the album cannot find a picture. Why make a photo album with missing pictures?
 
VictorV
QuestionScript Errors?memberKant14 Nov '02 - 17:23 
Hi,
 
I did all the steps as you mentioned. When I try to run the .chm file I get the following script errors.
 
Error 1 :
 
Line: 41
Char: 1
Error : Syntax Error
Code : 0
URL : mk@MSITSTORE:C:\.....\Album\2002Album.chm::/start.htm
 
Error 2 :
 
Line: 22
Char: 1
Error : 'sAlbumTitle' is undefined
Code : 0
URL : mk@MSITSTORE:C:\.....\Album\2002Album.chm::/start.htm
 
What I did wrong?
 
I am using Windows XP (Service Pack 1), IE 6.0.2800
thanks
 
Kant
AnswerRe: Script Errors?memberVictor Vogelpoel14 Nov '02 - 19:59 
I think there's a script syntax error in file photos.js, where sAlbumTitle is defined.
 
Did you properly create the aPhotos array, "filename" COMMA "TITLE" COMMA, with no comma at the last entry? aPhotos must be a valid Javascript string array!
Is the sAlbumTitle variable a correctly delimited string or is there a double quote INSIDE the sAlbumTitle string?
 

// Set the title of the album
sAlbumTitle = "Victor's demo album";
 
// Define the photos.
aPhotos = new Array(
//"Filename", "Caption",
"001.jpg", "TechED 2001: Fira entrance",
"002.jpg", "TechEd 2001: Don Box explaining SOAP" // NO COMMA HERE!
);
 
VictorV
GeneralWorks now...memberKant15 Nov '02 - 7:25 
Good catch.
 
The thing is I added so many lines at that point, I forgot to remove the extra comma.
 
Excellent job.
 
You got my 5.Cool | :cool:
 
Kant
GeneralElectronic Photo AlbumsussAnonymous10 Nov '02 - 17:00 
I have been working on this for about three hours now. It is not working. It keeps reverting to your album and says it cannot open my chm file. When I look for it I cannot find it. The pages have been changed as per your instructions.
 
I think the encoder is the problem.
 
It looks nice but is a lot of work.
 
Della
GeneralRe: Electronic Photo AlbummemberVictor Vogelpoel10 Nov '02 - 21:07 
I'd appreciate it if you don't post anonymously, Della.
 
Anonymous wrote:
It keeps reverting to your album and says it cannot open my chm file
 
I do not understand what's happening, why don't you send over your files and I'll take a look.
 
VictorV
GeneralThis rockssussDreamReaver6 Aug '02 - 10:20 
Thanks for putting this on the net Victor.
Your idea rocks!
I sat thinking to myself "There must be a simple way to do this", and this came up on my first search.
You saved me plenty of work.
 
Shot man.
 
DreamReaver

GeneralBrilliant!memberTom Archer7 May '02 - 14:15 
Ingenious idea, Victor!
 
Cheers,
Tom Archer
Author - Inside C#, Visual C++.NET Bible
 
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
GeneralRe: Brilliant!memberVictor Vogelpoel7 May '02 - 22:39 
Thanks!
GeneralDoesn´t work in Opera :-(membercarl chenox23 Apr '02 - 23:48 
This photo album is really a nice idea, easy to handle even for beginners, and thank´s that u put it there 4 free. But it doesn´t work in my Opera browser, maybe i just haven´t configured right, but there is allways a Java error when i´m trying to use the album.

GeneralRe: Doesn´t work in Opera :-(memberVictor Vogelpoel24 Apr '02 - 4:13 
I think you are using the html pages by themselves and not compiled into an Microsoft HTML Help (.CHM) file. This article is about doing fun stuff with HTML Help, and HTML Help always uses Internet Explorer components for displaying the pages.
The HTML files and JavaScript code are NOT meant to be used outside the HTML Help file, like on a website. Actually, it will only work for Internet Explorer; Opera and the other browsers won't work, like you found out. It is even mentioned in the article!
 
If you want to use Opera for displaying the album's HTML pages outside HTML Help, then you'll have to work that out for yourself. Or pay me to do it. Smile | :)
Opera is one of the worst browsers to create the album's functionality for... Dead | X|
 
VictorV

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

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 14 Nov 2002
Article Copyright 2002 by Victor Vogelpoel
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid