Making Templates
As of version 3.0 of Thumbs you can now make your own
templates. Templates tell Thumbs how to generate the
various pages it creates when you click "Make Thumbnails".
If you make a cool one please share it with us.
There are 3 levels of making a template. First we'll go over
the simplest.
Making a picture frame.
The simplest template you could probably make is to copy the
Purple-Frame template and change the frame. To do this, go
to the folder in which you installed Thumbs and inside that
folder you'll find a folder called Templates. Inside that
folder where will be one folder for each template you
have. Each Template must have its own folder and that
folder must be in the Templates folder
So. First, copy the folder "Purple-Frame" to
a new folder. The easiest way to do this is to select the
folder from the Windows Explorer, pick "Copy" from the
Edit menu and then "Paste" from the Edit menu.
This should create a copy of the folder called "Copy of
Purple-Frame". Rename it to something better.
Then, load up you favorite image editing program. Mine
is Photoshop but you can use any image editing program that can
save .GIF files.
Here's the original frame from "Purple-Frame"
After you are finished you need to cut your frame up into 8 parts and use the
names below for each part.
|

frame_tl.gif
|

frame_t.gif
|

frame_tr.gif
|
|

frame_l.gif
|
|

frame_r.gif
|
|

frame_bl.gif
|

frame_b.gif
|

frame_br.gif
|
As you can see here, it's important that the parts "frame_t.gif"
and "frame_b.gif", the top and the bottom middle parts, are
repeatable. That is if you copied them several times they would still look
correct. Below is the file "frame_b.gif" copied 8 times.
The same is true of the left and right pieces ("frame_l.gif" and
"frame_r.gif")
Finally you need to make a screenshot to be shown inside Thumbs. It
needs to be a .JPG file and it needs to be 188 pixels width by 220 pixels
tall. It needs to be named "screenshot.jpg".
Save or copy those 9 images to your new template folder and you're almost
done.
Options.txt
You need to edit the file "options.txt" that's in the template
folder for your template. Double click on it and you should be able to
edit it in the Windows Notepad.
[Options]
The most important part in this simple case is the [options] area. There you
specify how much a width and height adjustment to take into account how big your
frame is. The easiest way to figure this out it to run Thumbs once,
select your new template, make thumbnails, and
then edit one of the mid-size pages it generated. At near the top you'll
see 2 lines that look like this
widthAdjust = -168;
heightAdjust = -80;
First, view that page in your browser. Also edit that page in
Notepad. Make the the browser window tall and thin. If parts
of the page are off the right edge of the window then flip over to notepad and
adjust "widthAdjust" for example from "-168" to
"-188". Save the file, flip back to your browser and press the
refresh/reload button. Does it fit now? Keep adjusting until it does.
Then do the same for the "heightAdjust" although you will have to
first resize the browser window so it is wide and flat. Adjust the "heightAdjust"
value until the bottom of the page stops going off the bottom of the window.
You might have to adjust in the other direction too. If you make these
values too large then your image will appear smaller than the window.
Once you've figured out values that work, open "options.txt" for
your template and look for the [options] section and set the values to match the
ones you just figured out.
[options]
pictureWidthAdjust=-168
pictureHeightAdjust=-80
Set the to variables to the values you figured
out above.(note: they are negative numbers
so 30 more then -110 is -80)
[Colors]
[colors]
colorbackground=FFFFFF,unused
colortext=000000,default
colorlink=000080,default
colorused=800080,default
colorslidebackground=000000
This section is used to tell Thumbs what colors you recommend
people use. You put the color that Thumbs should use
followed optionally by the keywords "default" or
"unused".
Default means that although you recommend a particular color
the "Default" option will be checked inside Thumbs for
that particular color making the pages use the browser's default
colors.
Unused means your template has that particular color
hardcoded and it is therefore not settable by from Thumbs.
This is probably true for most templates for the background
color if the images expect to be blended to a particular
color. For example the shadows and icons in the
"Shadow" template all expect to be on white therefore
the background color is set unused for that template.
You're are
finished!!! Wasn't that easy?
Replacing All the the Images
It was pretty easy to replace the frame but if you want you
can replace every image in a template. It's just more
work.
Here are the names of the border parts used in both the
"Shadow" and "Purple-Frame" templates.

border_tl.gif |

border_t.gif |

border_tr.gif |

border_l.gif |
|

border_br.gif |

border_bl.gif |

border_b.gif |

border_br.gif |
And here's the bar used in those same templates.

bar_l.gif |

bar_m.gif |

bar_r.gif |
Here are the various icon images.

mini_arrow_l.gif |

mini_arrow_r.gif |

pic_list.gif |

pic_home.gif |

pic_magnify.gif |

slideshow.gif |

arrow_loff.gif |

arrow_roff.gif |
Some templates use a border around each slide

tborder-tl.gif |

tborder-t.gif |

tborder-tr.gif |

tborder-l.gif |
|

tborder-br.gif |

tborder-bl.gif |

tborder-b.gif |

tborder-br.gif |
| Note that
most of the templates stretch / shrink the top, left, right and bottom
images to fit the thumbnails. |

thumbs_banner.gif |

thumbs_logo.gif |
You can also change the images used for the slideshow
controls although I suggest you keep them the same size.
Normally they are stored in the same folder as the Thumbs
program but if you make local copies in a particular template
that template will use those local versions. If you change
the size you will need to edit the template so that it adjusts
the size of the control window to fit.
If you are using Photoshop you can download the Photoshop
files I used to make some of the templates that are included with Thumbs
here
Total Conversion
Changing all the HTML for a template
If you know HTML inside and out you can edit any of the HTML
for a template.
The #1 concern is that what you change the files too may not
be compatible across multiple browsers. You're on your own
in that respect. The only way you can be sure it to make
some thumbs and test them on a variety of platforms and
browsers.
The files are as follows
| index.html |
Template for the top level
page. The page that lists all your folders. |
| thumbs_page.html |
Template for thumbnail pages |
| midpage_jpg.html |
Template for viewing JPG files |
| midpage_movie.html |
Template for viewing MPG,MOV,QT,AVI files.
Usually this is the same as "midpage_jpg.html"
except the Javascript for scaling to fit the screen has
been removed and the HTML for using a movie viewer has
been added. |
| explorer_missing.html |
Template for
explorer view for folder that has no images |
| explorer_frames.html |
Template for the explorer view
page frames. |
| explorer_def_pane.html |
Template for the right pane of
the explorer view before any image or folder has been
chosen. |
| explorer_filelist.html |
Template for the file list pane
on the left side of the explorer view page. |
The files are optionally broken into parts. I part is marked by
inserting a comment in the following form
<!-- THUMBSPART:partname -->
The part named "main" is the part that will be
written to the corresponding destination file. Other parts
are used to help generate the various parts of the main file.
See below for an explanation of each part.
Copying referenced files.
Thumbs uses these files to build the HTML pages for your thumbnails. As
it reads them it will copy any files that they reference by looking for (src="",
href="" and background=""). In order for the files to
be copied they must be in the same template folder.
The copied files are not also parsed, they are just copied so
if you for example make "index.html" reference "letter.html"
and "letter.html" references "copyright.html",
"copyright.html" will not be copied. There
is a work around. Just put references to the extra
files in comments. For example
<!-- src="copyright.html" -->
Variables
While the template is being processed various variables are
available for substitution into the template. A variable
starts with $ and can optionally end with $ also. This
makes it possible to put a variable directly next to other text
$imageWidth$x$imageHeight
The second $ is ending the first variable.
For any variable that is numeric, like the width or height of
something, you can add, subtract, multiply or divide a single number using a
format like this
$imageWidth(+20) or $imageHeight(-15) or $imageWidth(*2) or
$imageWidth(/2)
for more complicated math see scripting
below.
Globals
These are available at all times in all templates parts
| $title: |
What the user entered in Thumbs |
| $bgcolor |
background color HTML |
| $textcolor |
text color HTML |
| $linkcolor |
link color HTML |
| $vlinkcolor |
vlink color HTML |
| $maxthumbwidth: |
the maximum width of a thumbnail as specfied in Thumbs |
| $maxthumbheight: |
the maximum height of a thumbnail as specfied in Thumbs |
| $picWidth() |
width in pixels of image specified inside the
(). Example
$picWidth(border.gif)
Note: the image must be in the same folder as the template.
|
| $picHeight() |
height in pixels of image specified inside the
(). Example
$picHeight(border.gif)
Note: the image must be in the same folder as the template.
|
| $totalfiles |
number of image/movie files in the entire
folder tree
|
index.html
These variable are available while processing index.html
| $thumbpagelinks: |
A list of links to each of the thumbnail pages
(generated from the parts below) |
| $explorerviewhtml: |
The HTML to insert to link to the explorer view if one exists |
| $slideshowviewhtml: |
The HTML to insert to show the slideshow if one exists |
| $thumbsbanner: |
The HTML to insert to show the Thumbs banner |
| $slideshowlink: |
Link from this page to the slideshow |
These variables are available while generating each folder
entry in the file list IF you've chosen to generate a folder
tree list
| $thumbslink: |
link to current thumbnail page |
| $thumbsfoldername: |
name of current folder |
| $indent: |
not important, used to make the HTML slightly more readable |
| $indent2: |
not important, used to make the HTML slightly more readable |
| $captionhtml |
the HTML to insert of there is a caption |
| $dirindent |
the value of the part <!--
thumbspart:dirindent --> below * the number of levels deep we are in
folders |
| $thumbpathfolder |
path to current folder |
<!-- thumbspart:dirstart -->
This part is inserted to start each folder that has some images inside it and
has sub folders
<!-- thumbspart:dirstart_empty -->
This part is inserted to start each folder that has no
images inside it but has sub folders.
This would only happen when you have subfolders and there's nothing in the
parent. For example if you had a folder called "male" and inside
you had folders "boys" and "men". In the last two
folders you have images but in the first folder you have none.
<!-- thumbspart:dirstart_nosubfolders -->
This part is inserted to start each folder that has some images inside
it but has sub folders
<!-- thumbspart:dirstart_nosubfolders_empty -->
This part is inserted to start each folder that has no
images and no sub folders inside it
<!-- thumbspart:dirend -->
This part is inserted to end each folder that has sub folders
inside
<!-- thumbspart:dirend_empty -->
This part is inserted to end each folder that has NO sub
folders inside
<!-- thumbspart:dirindent -->
This part is used to build the variable $dirindent. It
is inserted once for each sub level of folders.
If you are NOT using a folder tree then these variables are
available while each thumbnail page link is being generated.
| $thumbpagelink: |
link to current thumbnail page |
| $thumbsfoldername: |
name of folder for current thumbnail page |
| $thumbpathfolder |
path to current folder |
<!-- THUMBSPART:template_thumbpagehtml -->
This part contains the HTML used to generate a link to a
thumbnail page. In other words, for each folder, if
ithas images
this part will be inserted into the destination "index.html"
These parts are used in general while making the index.html
file
<!-- THUMBSPART:captionhtml -->
This part is the HTML inserted to for a caption. This part becomes the value of the variable
$captionhtml.
<!-- THUMBSPART:template_explorerviewhtml -->
This part is the HTML inserted to link to the explorer view. This part
becomes the value of the variable $explorerviewhtml.
<!-- THUMBSPART:template_slideshowhtml -->
This part is the HTML inserted to link to the
slideshow. This part becomes the value of the variable $slideshowviewhtml.
<!-- THUMBSPART:template_thumbsbanner -->
This part is the HTML to insert the Thumbs banner (created by Thumbs). It
becomes the value of $thumbsbanner.
thumbs_page.html
These variable are available while processing thumbs_page.html
| $thumbsfoldername: |
Name of the current folder |
| $slideshowhtml: |
The HTML to insert to show a link to the slideshow |
| $toppagelink: |
A link from this page to the homepage (index.html) |
| $prevthumbpagelink: |
Link to the next thumbnail page |
| $nextthumbpagelink: |
Link to the next thumbnail page |
| $pagenumber: |
Current thumbnail page number |
| $totalpages: |
Total number of thumbnail pages |
| $thumbnails: |
The HTML to display all the thumbnails
(generated from the parts below) |
| $thumbsbanner: |
The HTML to insert to show the Thumbs banner |
| $slideshowlink: |
Link from this page to the slideshow |
| $slidenum |
Number of first image on this
page. Passed to the slideshow to tell it which image to start on. |
| $numfilesonpage |
Total number of images/movies on current
page |
While each individual thumbnail is being generated these
variables are available
| $viewerlink: |
link to the mid size page for this thumbnail |
| $thumbnaillink: |
link to the image for the thumbnail |
| $filename: |
filename of image |
| $imagewidth: |
width of image in pixels (the image used
on the midsize page. original or midsize) |
| $imageheight: |
height of image in pixels (the image
used on the midsize page. original or midsize) |
| $originalimagewidth |
width of original image in pixels |
| $originalimageheight |
height of original image in pixels |
| $imagesize: |
size in bytes of image on midsize page.
To display the size in kilobytes you might do something like this
$fformat(%1.1f,$fdiv($imagesize,1024.0))
|
| $originalimagesize: |
size in bytes of original image.
To display the size in megabytes you might do something like this.
$fformat(%1.2f,$fdiv($originalimagesize,1048576.0))
|
| $thumbwidth: |
width in pixels of the thumbnail |
| $thumbheight: |
height in pixels of the thumbnail |
| $caption: |
"---" or "" or user entered caption |
| $captionhtml: |
The HTML to insert to make a caption |
| $comment |
the comment the user entered for the
folder or file |
| $commenthtml: |
The HTML to insert to make a
comment. Will be "" unless insert comments with Thumbnails
is checked in Thumbs |
| $foldercommenthtml |
the HTML to insert to put in the folder
comment |
| $currentfileindex |
The index of the current file relative
to all the files. (starts from 1) |
<!-- THUMBSPART:rowtop -->
<!-- THUMBSPART:rowmiddle -->
<!-- THUMBSPART:rowbottom -->
These parts are used to build the rows of a table for the thumbnails. rowtop is used to start the first row.
rowmiddle is used between
rows. rowbottom is used to end the last row.
<!-- THUMBSPART:thumbleft -->
<!-- THUMBSPART:thumbmiddle -->
<!-- THUMBSPART:thumbright -->
These parts are used to build the columns of a table for
the thumbails. thumbleft is used before the first
thumbnail on the left of each row. thumbmiddle is used
between each thumbnail in a row. thumbright is used
after the last thumbnail in each row.
<!-- THUMBSPART:thumbnail -->
This part is inserted for each thumbnail and is combined with the parts above
to create the variable $thumbnails
<!-- THUMBSPART:captionhtml -->
This part is inserted for each thumbnail if there is a caption or if
"Insert Space for Captions" is checked in Thumbs
<!-- THUMBSPART:commenthtml -->
This part is inserted for each thumbnail if "Put Comments on Thumbnail
Pages" is checked in Thumbs
<!-- THUMBSPART:foldercommenthtml -->
This part is inserted for the folder comment if there is a comment for the
folder.
<!-- THUMBSPART:template_slideshowhtml -->
This part is the HTML inserted to link to the
slideshow. This part becomes the value of the variable $slideshowviewhtml.
<!-- THUMBSPART:template_thumbsbanner -->
This part is the HTML to insert the Thumbs banner (created by Thumbs). It
becomes the value of $thumbsbanner.
midpage_movie.html
Depending on what you change you made need to edit the "options.txt"
file for your template. See this
section for most of the details.
On top of the info in that section there are also these two
settings
commentWidthAdjust=0
commentHeightAdjust=-14
These adjust the size of the mid-size images even more based
on if you have a comment or not. If you have a comment
then commentWidthAdjust is added to the width and
commentHeightAdjust is multiplied by the number of lines in your
comment and then added to the height.
These variables are available while building the mid-size
pages
| $filename: |
name of file |
| $filenamenohtml |
name of file stripped of html.
Used for the title of the page incase the user used html in the name
section of their comment file. |
| $imagewidth: |
width of image in pixels (the image used
on this page. original or midsize) |
| $imageheight: |
height of image in pixels (the image
used on this page. original or midsize) |
| $originalimagewidth |
width of original image in pixels |
| $originalimageheight |
height of original image in pixels |
| $defImageWidth: |
width of screen specified in Thumbs (used when the image cannot be scaled) |
| $defImageHeight: |
height of screen specified in Thumbs (used when the image cannot be scaled) |
| $widthAdjust: |
amount to adjust width to take into account the border graphics |
| $heightAdjust: |
amount to adjust height to take into account the border graphics |
| $imagesize: |
size in bytes of image on midsize page.
To display the size in kilobytes you might do something like this
$fformat(%1.1f,$fdiv($imagesize,1024.0))
|
| $originalimagesize: |
size in bytes of original image.
To display the size in megabytes you might do something like this.
$fformat(%1.2f,$fdiv($originalimagesize,1048576.0))
|
| $viewerjslink: |
link from this page to the viewer javascript |
| $toppagelink: |
A link from this page to the homepage (index.html) |
| $imagelink: |
link to the image that should be used on
the this page (original or midsize depending on if you chose to build
midsize images) |
| $originalimagelink |
link to the original image |
| $moviehtml |
HTML to insert to view a movie,
different for MPG vs MOV vs AVI |
| $thumbslink: |
like to the thumbnail page that contains this image |
| $slideshowhtml: |
The HTML to insert to show a link to the slideshow |
| $prevviewerlink: |
link to the next mid-size page |
| $nextviewerlink: |
link to the next mid-size page |
| $viewerimagewidth: |
width to display images in non-scaling browsers |
| $viewerimageheight: |
height to display images in non-scaling browsers |
| $thumbsbanner: |
The HTML to insert to show the Thumbs banner |
| $slideshowlink: |
Link from this page to the slideshow |
| $slidenum |
Number of this image. Passed to
the slideshow to tell it which image to start on. |
| $currentfileindex |
The index of the current file relative
to all the files. (starts from 1) |
| $comment |
the comment the user entered |
| $commenthtml |
The HTML to insert to make a comment. |
<!-- THUMBSPART:commenthtml -->
This part is the HTML inserted if there is a comment
<!-- THUMBSPART:template_slideshowhtml -->
This part is the HTML inserted to link to the
slideshow. This part becomes the value of the variable $slideshowviewhtml.
<!-- THUMBSPART:template_thumbsbanner -->
This part is the HTML to insert the Thumbs banner (created by Thumbs). It
becomes the value of $thumbsbanner.
<!-- THUMBSPART:template_html_mpg -->
This part is the HTML to insert the to show an mpg file
<!-- THUMBSPART:template_html_mov -->
This part is the HTML to insert the to show an quicktime mov/qt file
<!-- THUMBSPART:template_html_avi -->
This part is the HTML to insert the to show an avi file
explorer_filelist.html
These variables are available while generating the filelist pane of the
explorer view.
| $filelist: |
HTML for list of files (generated from
parts below) |
These variables are available while generating each folder
entry in the file list
| $thumbslink: |
link to page of thumbnails for this folder |
| $thumbsname: |
name of folder |
| $indent: |
not important, used to make the HTML slightly more readable |
| $indent2: |
not important, used to make the HTML slightly more readable |
These variables are available while generating each file entry in the file
list
| $thumbnaillink: |
link to mid-size page for picture |
| $thumbnailname: |
filename of picture |
| $indent: |
not important, used to make the HTML slightly more readable |
| $indent2: |
not important, used to make the HTML slightly more readable |
<!-- thumbspart:dirstart -->
This part is inserted to start each folder that has some images inside it.
<!-- thumbspart:dirstart_empty -->
This part is inserted to start each folder that has nothing inside it.
This would only happen when you have subfolders and there's nothing in the
parent. For example if you had a folder called "male" and inside
you had folders "boys" and "men". In the last two
folders you have images but in the first folder you have none.
<!-- thumbspart:fileentry -->
This part is inserted for each image.
<!-- thumbspart:dirend -->
This part is inserted to end each folder
Customizing even more
The following files are stored in the Thumbs installation
folder. If you want to customize them for a particular
template just copy them to that particular template's
folder. Thumbs will use those files instead for that
particular template.
| slideshow.html |
Template for the file
that is linked to by all the slideshow links in other
pages. It contains a list of all the images in the entire
slideshow. |
|
showpic.html |
Template for the file
that slideshow.html calls to show each image |
|
viewer.js |
Javascript for scaling
the mid-sized page images |
|
outline.js |
Javascript for the making
the explorer view file tree expand and contract |
slideshow.html
| $slidetime: |
number of seconds to show each image as
specified in Thumbs |
| $slidelist: |
list of information for each slide as
generated by the parts below |
These variables are available while generating each file entry to the
slidelist above using the parts below
| $imagepath: |
path to the image from slideshow.html |
| $midpagepath: |
path to the mid-size page for this image |
| $imageWidth: |
width of the image |
| $imageHeight: |
height of the image |
showpic.html
| $slidebgcolor: |
background color HTML for the slideshow |
Scripting
For some crazy reason I decided to had functions to allow
some simple scripting. I have not actually used it much
yet so I'm not sure what's missing and I'm not sure what bugs
there are. If you would like to play with it though here's
the functions. If you find you need some special function
or that something is broken then feel free to write me but I
can't promise anything.
Basically these are functions kind of like $picWidth() and $picHeight()
above except they do more *scripting* like stuff.
| $fnop (...) | anything
inside the parentheses is ignored. Kind of a way to comment something
out. |
| $fset (var,value) | set
the variable called var to value |
| $fadd (value1,value2,...) | add
value1 to value2 (then add value3, ... etc) |
| $fsubtract,$fsub (value1,value2,...) | sub
value2 from value1 (then subtract value3, ...etc) |
| $fdivide,$fdiv (value1,value2,...) | divide
value1 by value2 (then divide by value3, ...etc) |
| $fmultiply,$fmul,$fmult (value1,value2,...) | multiply
value1 by value2 (then multiply by value3, ..etc) |
| $fmodulo,$fmod (value1,value2,...) | return
the remainder when dividing value1 by value2 |
| $fconcatenate,$fconcate,$fcat (str1,
str2, ...) | concatenate str2
on the end of str1 (then str3 on the end of that etc) |
| $fsubstr (str,index[,len]) | return
the substring of str. If just index is specified then
you get the substring from index to the end of the string. If len
is specified then you get len characters after index |
| $fleft(str,count) | return
the left count characters of str |
| $fright(str,count) | return
the right count characters of str |
| $fstrlen (str1,...) | return
the length the str1 (plus str2, etc...) |
| $fif (value,truecase[,falsecase]) | if
value is true return truecase, else, if there is a falsecase
return it |
| $fequal,$feq (value1,value2) | return
1 if value1 is equal to value2 (integer compare) |
| $fgreaterthan,$fgt (value,value) | return
1 if value1 is greater than to value2 (integer compare) |
| $fgreaterthanequal,$fge (value,value) | return
1 if value1 is greater than or equal to value2 (integer
compare) |
| $flessthan,$flt (value,value) | return
1 if value1 is less than to value2 (integer compare) |
| $flessthanequal,$fle (value,value) | return
1 if value1 is less than or equal to value2 (integer compare) |
| $fnotequal,$fne, (value,value) | return
1 if value1 is not equal to value2 (integer compare) |
| $for (value,value,...) | return
1 if value1 is OR value2 is not zero (or value3,...
etc) (integer compare) |
| $fand (value,value,...) | return
1 if value1 is AND value2 is not zero (and value3,...
etc) (integer compare) |
| $fnot(value) | return
1 if value is zero, else return 0 |
| $frand(range) ... (min,max) | return
a random number. If one argument is specified the returned value will
be from 0 to 1 - that number. If two numbers are specified the number
returned will be from min to max-1 |
| $fstrcmp(str1,str2) | compare
str1 to str2. Return -1 if str1 is asciibetically
lower than str2, 0 if they are equal, 1 if str1 is
asciibetically higher than str2 |
| $fstricmp(value,value) | compare
str1 to str2 case insensitive (using stricmp). Return -1
if str1 is asciibetically lower than str2, 0 if they are
equal, 1 if str1 is asciibetically higher than str2 |
| $fascii(str) | return
the ascii value of the first character of str |
| $fquote(str) | quote
a str. This is used to make macros. Normally, all arguments are
interpreted when they are first used. This function prevents
that. Example:
$fset(filename,mypic.jpg)
$fset(somecode,$picWidth($filename))
Assuming mypic.jpg is 75 pixels wide somecode="75"
$fset(filename,mypic.jpg)
$fset(somecode,$fquote($picWidth($filename)))
In this case somecode="$picWidth($filename)" which means later
in the code you can do this put $somecode in your HTML and it will get
evaluated |
| $fsearch(string1,string2) | find
string2 in string1, if found return the index to the first character
found or -1 if not found |
| $fint(value) | convert
an float to an int. 27.9 becomes 27 |
| $fformat(string,arg) | format arg
using string like printf from C/C++
fformat only does one value at a time. The first argument is the
formatting specification. The second is the value to format. A formatting
specification starts with % although thumbs will add it of you forget. It
ends with one of the these
letters
| Character |
Type |
Output format |
| c |
integer |
specifies a single-byte character |
| C |
integer |
specifies a single-byte character. |
| d |
integer |
Signed decimal integer. |
| i |
integer |
Signed decimal integer. |
| o |
integer |
Unsigned octal integer. |
| u |
integer |
Unsigned decimal integer. |
| x |
integer |
Unsigned hexadecimal integer, using "abcdef." |
| X |
integer |
Unsigned hexadecimal integer, using "ABCDEF." |
| e |
float |
Signed value having the form [ ]d.dddd
e [sign]ddd where d is a single
decimal digit, dddd is one or more decimal digits, ddd
is exactly three decimal digits, and sign is + or . |
| E |
float |
Identical to the e format except that E
rather than e introduces the exponent. |
| f |
float |
Signed value having the form [ ]dddd.dddd,
where dddd is one or more decimal digits. The number of
digits before the decimal point depends on the magnitude of the
number, and the number of digits after the decimal point depends
on the requested precision. |
| g |
float |
Signed value
printed in f or e format, whichever is more
compact for the given value and precision. The e
format is used only when the exponent of the value is less than
4 or greater than or equal to the precision argument. Trailing
zeros are truncated, and the decimal point appears only if one or
more digits follow it. |
| G |
float |
Identical to the g
format, except that E, rather than e, introduces the
exponent (where appropriate). |
| s |
String |
specifies a string;
Characters are printed up to the first null character or until the precision
value is reached. |
If
you know C or C++ Thumbs is just using printf. If not you can read about how
the formatting works here
example:
fformat(%1.1f,27.4699)
the %1.1f above says; Print at least 1 character and print
one and only one after the decimal so in the example above you'd get
"27.5".
%5.3 would print at least five
characters with 3 after the decimal point so "2.54" would become
"2.540".
%09.4f would make
it "0002.5400".
%9.4f would make it " 2.5400"
Note the the last example of " 2.5400" would
not work in HTML because HTML usually converts a bunch of spaces to one
space. Only inside a <pre> </pre> section are spaces not
ignored. (pre = preformatted). If you need things to be right aligned
use HTML's align property instead of spaces. |
What could this be used for? Well, you could make a
template that picked different borders if the width of the
thumbnail was bigger than the height. Apple's iPhoto does
this. You could also make a template that picked different
borders based on the size of the image or at random. Stuff
like that. Here's a mostly useless example but...
$fmult($thumbwidth,$fif($fmod($fsubstr($filename,3,5),2),1,2))
The above example returns the width of a thumbnail OR double
the width based on whether or not the filename of the file has
an odd or even number. It assumes the files are named
"dsc12345.jpg" for example.
You can also do more complicated math than before.
Example:
width="$fadd($picWidth(border-l.gif),$thumbwidth,$picWidth(border-r.gif))"
and stuff like that.$
As of version 4.60 Thumbs supports both integers and floating
point numbers in scripting. An integer is a number with no
decimal point. If all values are integers then Thumbs
uses integer math. If a one value is a floating point
number then it assumes both are. So for example:
$fdiv(5,2) = 2
$fdiv(5,2.0) = 2.5
$fdiv(5.0,2) = 2.5
$fmult($fdiv(5,2),3) = 2 * 3 = 6
$fmult($fdiv(5,2),3.0) = 2 * 3.0 = 6.0
$fmult($fdiv(5,2.0),3) = 2.5 * 3 = 7.5
EXIF Information:
The follow variables are available during thumbs_page.html and
midpage_jpg.html processing (see above). These fields are
defined by the EXIF standard which can be downloaded from this
page.
| $EXIF_DateTime: | DateTime |
| $EXIF_ImageDescription: | ImageDescription |
| $EXIF_Make: | Make |
| $EXIF_Model: | Model |
| $EXIF_Software: | Software |
| $EXIF_Artist: | Artist |
| $EXIF_Copyright: | Copyright |
| $EXIF_DateTimeOriginal: | DateTimeOriginal |
| $EXIF_UserComment: | UserComment |
| $EXIF_ExifVersion: | ExifVersion |
| $EXIF_TIFFTitle: | TIFFTitle |
| $EXIF_TIFFComment: | TIFFComment |
| $EXIF_TIFFCaption: | TIFFCaption |
| $EXIF_JPEGComment: | JPEGComment |
| $EXIF_DateTimeDigitized: | DateTimeDigitized |
| $EXIF_ExposureTime: | ExposureTime |
| $EXIF_FNumber: | FNumber |
| $EXIF_SpectralSensitivity: | SpectralSensitivity |
| $EXIF_ShutterSpeedValue: | ShutterSpeedValue |
| $EXIF_ApertureValue: | ApertureValue |
| $EXIF_BrightnessValue: | BrightnessValue |
| $EXIF_ExposureBiasValue: | ExposureBiasValue |
| $EXIF_MaxApertureValue: | MaxApertureValue |
| $EXIF_SubjectDistance: | SubjectDistance |
| $EXIF_FocalLength: | FocalLength |
| $EXIF_FlashEnergy: | FlashEnergy |
| $EXIF_FocalPlaneXResolution: | FocalPlaneXResolution |
| $EXIF_FocalPlaneYResolution: | FocalPlaneYResolution |
| $EXIF_FocalPlaneResolutionUnit: | FocalPlaneResolutionUnit |
| $EXIF_ExposureIndex: | ExposureIndex |
| $EXIF_SubjectLocation: | SubjectLocation |
| $EXIF_ExposureProgram: | ExposureProgram |
| $EXIF_MeteringMode: | MeteringMode |
| $EXIF_Flash: | Flash |
| $EXIF_LightSource: | LightSource |
| $EXIF_SensingMethod: | SensingMethod |
| $EXIF_GPSLatitudeRef: | GPSLatitudeRef |
| $EXIF_GPSLatitude: | GPSLatitude |
| $EXIF_GPSLongitudeRef: | GPSLongitudeRef |
| $EXIF_GPSLongitude: | GPSLongitude |
| $EXIF_GPSAltitude: | GPSAltitude |
| $EXIF_GPSTimeStamp: | GPSTimeStamp |
| $EXIF_GPSSatellites: | GPSSatellites |
| $EXIF_GPSStatus: | GPSStatus |
| $EXIF_GPSMeasureMode: | GPSMeasureMode |
| $EXIF_GPSDOP: | GPSDOP |
| $EXIF_GPSSpeedRef: | GPSSpeedRef |
| $EXIF_GPSSpeed: | GPSSpeed |
| $EXIF_GPSTrackRef: | GPSTrackRef |
| $EXIF_GPSTrack: | GPSTrack |
| $EXIF_GPSImgDirectionRef: | GPSImgDirectionRef |
| $EXIF_GPSImgDirection: | GPSImgDirection |
| $EXIF_GPSMapDatum: | GPSMapDatum |
| $EXIF_GPSDestLatitudeRef: | GPSDestLatitudeRef |
| $EXIF_GPSDestLatitude: | GPSDestLatitude |
| $EXIF_GPSDestLongitudeRef: | GPSDestLongitudeRef |
| $EXIF_GPSDestLongitude: | GPSDestLongitude |
| $EXIF_GPSDestBearingRef: | GPSDestBearingRef |
| $EXIF_GPSDestBearing: | GPSDestBearing |
| $EXIF_GPSDestDistanceRef: | GPSDestDistanceRef |
| $EXIF_GPSDestDistance: | GPSDestDistance |
IPTC Information:
The follow variables are available during thumbs_page.html and
midpage_jpg.html processing (see above). These fields are
defined by the IPTC standard which can be downloaded from the IPTC
website.
| Variable Name | IPTC
Code | Description |
| $IPTC_001_000 | 1: 0: | Model Version |
| $IPTC_001_005 | 1: 5: | Destination |
| $IPTC_001_020 | 1: 20: | File Format |
| $IPTC_001_022 | 1: 22: | File Format Version |
| $IPTC_001_030 | 1: 30: | Service Indentifier |
| $IPTC_001_040 | 1: 40: | Envelope Number |
| $IPTC_001_050 | 1: 50: | Product I.D. |
| $IPTC_001_060 | 1: 60: | Envelope Priority |
| $IPTC_001_070 | 1: 70: | Date Sent |
| $IPTC_001_080 | 1: 80: | Time Sent |
| $IPTC_001_090 | 1: 90: | Coded Character Set |
| $IPTC_001_100 | 1:100: | UNO |
| $IPTC_001_120 | 1:120: | ARM Identifier |
| $IPTC_001_122 | 1:122: | ARM Version |
| $IPTC_002_000 | 2: 0: | Record Version |
| $IPTC_002_003 | 2: 3: | Object Type Reference |
| $IPTC_002_004 | 2: 4: | Object Attribute Reference |
| $IPTC_002_005 | 2: 5: | Object Name |
| $IPTC_002_007 | 2: 7: | Edit Status |
| $IPTC_002_008 | 2: 8: | Editorial Update |
| $IPTC_002_010 | 2: 10: | Urgency |
| $IPTC_002_012 | 2: 12: | Subject Reference |
| $IPTC_002_015 | 2: 15: | Category |
| $IPTC_002_020 | 2: 20: | Supplemental Category |
| $IPTC_002_022 | 2: 22: | Fixture Identifier |
| $IPTC_002_025 | 2: 25: | Keywords |
| $IPTC_002_026 | 2: 26: | Content Location Code |
| $IPTC_002_027 | 2: 27: | Content Location Name |
| $IPTC_002_030 | 2: 30: | Release Date |
| $IPTC_002_035 | 2: 35: | Release Time |
| $IPTC_002_037 | 2: 37: | Expiration Date |
| $IPTC_002_038 | 2: 38: | Expiration Time |
| $IPTC_002_040 | 2: 40: | Special Instructions |
| $IPTC_002_042 | 2: 42: | Action Advised |
| $IPTC_002_045 | 2: 45: | Reference Service |
| $IPTC_002_047 | 2: 47: | Reference Date |
| $IPTC_002_050 | 2: 50: | Reference Number |
| $IPTC_002_055 | 2: 55: | Date Created |
| $IPTC_002_060 | 2: 60: | Time Created |
| $IPTC_002_062 | 2: 62: | Digital Creation Date |
| $IPTC_002_063 | 2: 63: | Digital Creation Time |
| $IPTC_002_065 | 2: 65: | Originating Program |
| $IPTC_002_070 | 2: 70: | Program Version |
| $IPTC_002_075 | 2: 75: | Object Cycle |
| $IPTC_002_080 | 2: 80: | By-line |
| $IPTC_002_085 | 2: 85: | By-line Title |
| $IPTC_002_090 | 2: 90: | City |
| $IPTC_002_092 | 2: 92: | Sub-location |
| $IPTC_002_095 | 2: 95: | Province/State |
| $IPTC_002_100 | 2:100: | Country/Primary Location Code |
| $IPTC_002_101 | 2:101: | Country/Primary Location Name |
| $IPTC_002_103 | 2:103: | Original Transimission Reference |
| $IPTC_002_105 | 2:105: | Headline |
| $IPTC_002_110 | 2:110: | Credit |
| $IPTC_002_115 | 2:115: | Source |
| $IPTC_002_116 | 2:116: | Copyright Notice |
| $IPTC_002_118 | 2:118: | Contact |
| $IPTC_002_120 | 2:120: | Caption/Abstract |
| $IPTC_002_122 | 2:122: | Writer/Editor |
| $IPTC_002_130 | 2:130: | Image Type |
| $IPTC_002_131 | 2:131: | Image Orientation |
| $IPTC_002_135 | 2:135: | Language Identifier |
| $IPTC_002_150 | 2:150: | Audio Type |
| $IPTC_002_151 | 2:151: | Audio Sampling Rate |
| $IPTC_002_152 | 2:152: | Audio Sampling Resolution |
| $IPTC_002_153 | 2:153: | Audio Duration |
| $IPTC_002_154 | 2:154: | Audio Octcue |
| $IPTC_002_200 | 2:200: | ObjectData Preview File Format |
| $IPTC_002_202 | 2:202: | ObjectData Preview File Format Version |

|