(* Creating photo-indexes. Pictures cropped to square should be already present! *) Clear["@"]; (********** INPUT STARTS **********) (* HTML/pictures/archives-directory *) dir0="d:\\html\\pictures\\archives"; (* working directory *) dirwork="d:\\sergeev\\bgu\\html\\maintain"; (* temp. file *) temp="d:\\temp\\tempcomp"; itest=0; (* 1 for testing *) iprint=0; newmont=0; (* weather to create new photomontage *) {charleft,charright}={50,40}; (* number of characters in a shortened title *) dirarr="D:\\sergeev\\bgu\\html\\maintain"; (* dir. with back and next arrows *) backarr=dirarr<>"\\back.gif"; nextarr=dirarr<>"\\next.gif"; thsize=94(*125*); (* size of square thumbnails *) columns0=7; (* max n. of columns in the tile *) (********** INPUT ENDS **********) SetDirectory[dirwork]; <Infinity,FormatType->OutputForm]; ""//p; ""//p; t="Full list of "<>ToString[mmmpics]<>" pictures from archives "<>First[years]<>" - "<>Last[years]; ""<>t<>""//p; ""//p; "

"<>t<>"

"//p; "

The following list was printed automatically. It does not include Black and white pictures.

"//p; "

Contents

"//p; ""//p; Do[year=years[[nyear]]; If[mmpics[year]==0,Continue[]]; rolls0=rolls[year]; mrolls0=mrolls[year]; listrolls=""; Do[roll=rolls0[[nroll]]; listrolls=listrolls<>"roll<>"\">"<>roll<>" "; ,{nroll,mrolls0}]; ""//p; ,{nyear,myears}]; "
YearsRolls of film
year<>"\">"<>year<>""<>listrolls<>"

year<>"/list.htm\" NAME=\"y"<>year<>"\" TARGET=\"_blank\">Year "<>year<>". "<>yearcap[year]<>", "<>ToString[mmpics[year]]<>" pictures

year<>"/"<>roll<>"/browser.htm\" NAME=\"r"<>roll<>"\" TARGET=\"_blank\">Roll #"<>roll<>": "<>rolltitle[roll]<>"

"//p; (* References *) "

"//p; ""//p; ""//p; (*""//p;*) ""//p; ""//p; ""//p; "
Picture ArchivesSelected PicturesRandom Slide ShowTechnical detailsDirectory of filesA. Sergeev

"//p; ""//p; Close[of]; (***** Printing browser.jpg and browser.htm *****) (* Cycle through all rolls *) Do[{year,roll}=toroll[nroll]; firstroll=(nroll==1); lastroll=(nroll==mmrolls); mpics02=mpics0=mpics[roll]; If[mpics0==0,Continue]; pics0=pics[roll]; (* Montage of photo-index *) SetDirectory[ToFileName[{dir0,"compress",year,roll}]]; montfile="montage.jpg"; (* take into account back and next arrows *) If[!firstroll,mpics02=mpics02+1]; If[!lastroll,mpics02=mpics02+1]; columns=If[mpics0221,5,{ 1,2,3,4,5, 3(*6=2x3*),4(*7=4+3*),4(*8=2x4*),5(*9=5+4*),5(*10=5+5*), 4(*11=2x4+3*),4(*12=3x4*),5(*13=2x5+3*),5(*14=2x5+4*),5(*15=3x5*), 6(*16=2x6+4*),6(*17=2x6+5*),6(*18=3x6*), 5(*19=3x5+4*),5(*20=4x5*) }[[mpics02]] ]]; If[thsize==94,columns=If[mpics02>36,7,{ 1,2,3,4,5,6,7, 4(*8=2x4*),5(*9=5+4*),5(*10=2x5*),6(*11=6+5*),6(*12=2x6*), 7(*13=7+6*),7(*14=2x7*),5(*15=3x5*), 6(*16=2x6+4*),6(*17=2x6+5*),6(*18=3x6*), 7(*19=2x7+5*),7(*20=2x7+6*),7(*21=3x7*), 6(*22=3x6+4*),6(*23=3x6+5*),6(*24=4x6*), 7(*25=3x7+4*),7(*26=3x7+5*),7(*27=3x7+6*),7(*28=4x7*), 6(*29=4x6+5*),6(*30=5x6*), 7(*31=4x7+3*),7(*32=4x7+4*),7(*33=4x7+5*),7(*34=4x7+6*), 7(*35=5x7*),6(*36=6x6*) }[[mpics02]] ]]; width=ToString[columns thsize]; rows=Ceiling[mpics02/columns]; height=ToString[rows thsize]; If[FileType[montfile]=!=File || newmont!=0, doscom="montage -quality 100 -geometry 94x94 -tile "<> ToString[columns]<>"x"<>ToString[rows]<>" "; If[!firstroll,doscom=doscom<>backarr<>" "]; Do[doscom=doscom<>"jpeg\\"<>pics0[[npic]]<>" ",{npic,mpics0}]; If[!lastroll,doscom=doscom<>nextarr<>" "]; doscom=doscom<>montfile; os=OpenWrite["temp.bat",PageWidth->Infinity,FormatType->OutputForm]; Write[os,doscom]; Write[os,"mogrify -crop "<>width<>"x"<>height<>"+0+0 -quality 60 -sharpen 10% "<>montfile]; Close[os]; Run["temp.bat"]; DeleteFile["temp.bat"]; ]; (* End If *) (***** Printing browser.htm *****) oldbrows=ToFileName[{dir0,year,roll},"oldbrows.htm"]; browser=ToFileName[{dir0,year,roll},"browser.htm"]; (* Necessary only for the first time! *) (* If[FileType[browser]===File&&FileType[oldbrows]=!=File, Print["Renaming ",browser," to ",oldbrows]; RenameFile[browser,oldbrows]]; *) rolltit=rolltitle[roll]; refmont="../../compress/"<>year<>"/"<>roll<>"/"<>montfile; prevmont=If[firstroll,"", {yearprev,rollprev}=toroll[nroll-1]; "../../compress/"<>yearprev<>"/"<>rollprev<>"/"<>montfile]; nextmont=If[lastroll,"", {yearnext,rollnext}=toroll[nroll+1]; "../../compress/"<>yearnext<>"/"<>rollnext<>"/"<>montfile]; altmont="../../compress/"<>year<>"/"<>roll<>"/"<>"montage1.jpg"; of=OpenWrite[browser,PageWidth->Infinity,FormatType->OutputForm]; ""//p; ""//p; ""<>rolltit<>": thumbnail preview of photos"//p; ""//p; ""//p; ""//p; ""//p; ""//p; ""//p; ""//p; ""//p; ""//p; "altmont<>"';"<> If[firstroll,"","document.prev.src='"<>prevmont<>"';"]<> If[lastroll,"","document.next.src='"<>nextmont<>"';"]<>"\">"//p; ""//p; "

"<>rolltit<>"

"//p; "

refmont<>"\" BORDER=\"0\" WIDTH=\""<>width<> "\" HEIGHT=\""<>height<>"\" ALT=\"Photomontage of "<>ToString[mpics0]<>" square thumbnails\" USEMAP=\"#browser\">

"//p; ""//p; "

"//p; ""//p; "
"//p; ""//p; ""//p; ""//p; ""//p; "
"//p; "Enlarge this photomontage |"//p; Do[year1=years[[nyear1]]; "year1<>"/list.htm\" ONMOUSEOVER=\"over('Index of pictures taken in "<>year1<>" ("<> ToString[mmpics[year1]]<>" pictures in "<>ToString[mrolls[year1]]<> " rolls of film)')\" ONMOUSEOUT=\"out()\">"<>year1<>" |"//p; ,{nyear1,myears}]; "years[[1]]<>" - "<>years[[myears]]<>"')\" ONMOUSEOUT=\"out()\">Index |"//p; "ToString[mmmpics]<> " pictures in "<>ToString[mmrolls]<>" film rolls, for "<>ToString[myears]<> " years')\" ONMOUSEOUT=\"out()\">Full List |"//p; "Selected Pict."//p; "
"//p; ""//p; "


"//p; "Home page"//p; ""//p; If[!firstroll, ""//p]; If[!lastroll, ""//p]; "

"//p; coord[nth_]:=( nrow=Ceiling[nth/columns]; ncol=nth-columns (nrow-1); x11=thsize(ncol-1); y11=thsize(nrow-1); x22=thsize ncol; y22=thsize nrow; ToString[x11]<>","<>ToString[y11]<>","<>ToString[x22]<>","<>ToString[y22] ); nthum=0; If[!firstroll,nthum++; ref="../../"<>yearprev<>"/"<>rollprev<>"/browser.htm"; wstat="To the previous roll of film: "<>shrink[rolltitle[rollprev],25,15,0]; "coord[nthum]<>"\" href=\""<>ref<>"\" ONMOUSEOVER=\"over('"<>wstat<>"')\" ONMOUSEOUT=\"out()\">"//p; ]; Do[nthum++; pic=pics0[[npic]]; ref="../../compress/"<>year<>"/"<>roll<>"/"<>StringReplace[pic,"jpg"->"htm",IgnoreCase->True]; wstat=shrink[description[year,roll,pic],40,30,0]; "coord[nthum]<>"\" href=\""<>ref<>"\" ONMOUSEOVER=\"over('"<>wstat<>"')\" ONMOUSEOUT=\"out()\">"//p; ,{npic,mpics0}]; If[!lastroll,nthum++; ref="../../"<>yearnext<>"/"<>rollnext<>"/browser.htm"; wstat="To the next roll of film: "<>shrink[rolltitle[rollnext],27,17,0]; "coord[nthum]<>"\" href=\""<>ref<>"\" ONMOUSEOVER=\"over('"<>wstat<>"')\" ONMOUSEOUT=\"out()\">"//p; ]; "

"//p; ""//p; ""//p; Close[of]; (* Printing enlarged photoindex *) SetDirectory[ToFileName[{dir0,year,roll}]]; montfile=ToFileName[{dir0,"compress",year,roll},"montage1.jpg"]; If[FileType[montfile]=!=File || newmont!=0, (* take into account back and next arrows *) doscom="montage -frame 5x3+2+0 -quality 100 -geometry 300x250 -tile 1x40 "; Do[doscom=doscom<>"jpeg\\"<>pics0[[npic]]<>" ",{npic,mpics0}]; doscom=doscom<>montfile; os=OpenWrite["temp.bat",PageWidth->Infinity,FormatType->OutputForm]; Write[os,doscom]; Write[os,"mogrify -crop 310x"<>ToString[260 mpics0]<>"+0+0 -quality 60 -sharpen 10% "<>montfile]; Close[os]; Run["temp.bat"]; DeleteFile["temp.bat"]; ]; (* End If *) (***** Printing browser1.htm *****) browser=ToFileName[{dir0,year,roll},"browser1.htm"]; refmont="../../compress/"<>year<>"/"<>roll<>"/"<>"montage1.jpg"; prevmont=If[firstroll,"", {yearprev,rollprev}=toroll[nroll-1]; "../../compress/"<>yearprev<>"/"<>rollprev<>"/"<>"montage1.jpg"]; nextmont=If[lastroll,"", {yearnext,rollnext}=toroll[nroll+1]; "../../compress/"<>yearnext<>"/"<>rollnext<>"/"<>"montage1.jpg"]; altmont="../../compress/"<>year<>"/"<>roll<>"/"<>"montage.jpg"; of=OpenWrite[browser,PageWidth->Infinity,FormatType->OutputForm]; ""//p; ""//p; ""<>rolltit<>": enlarged thumbnail preview of photos"//p; ""//p; ""//p; ""//p; ""//p; ""//p; ""//p; ""//p; ""//p; "altmont<>"';"<> If[firstroll,"","document.prev.src='"<>prevmont<>"';"]<> If[lastroll,"","document.next.src='"<>nextmont<>"';"]<>"\">"//p; ""//p; "

"<>rolltit<>"

"//p; ""//p; theight=pheight=(250+10)mpics0; If[!firstroll,theight=theight+113]; If[!lastroll,theight=theight+113]; " ToString[theight]<>"\">"//p; If[!firstroll, ref="../../"<>yearprev<>"/"<>rollprev<>"/browser1.htm"; wstat="To the previous roll of film: "<>shrink[rolltitle[rollprev],25,15,0]; ""//p; ""//p; ""//p; ]; ""//p; ""//p; ""//p; ""//p; ""//p; ""//p; ""//p; Do[ ""//p; ""//p; ""//p; ""//p; ,{npic,2,mpics0}]; ""//p; If[!lastroll, ref="../../"<>yearnext<>"/"<>rollnext<>"/browser1.htm"; wstat="To the next roll of film: "<>shrink[rolltitle[rollnext],25,15,0]; ""//p; ""//p; ""//p; ]; "
ref<>"\" ONMOUSEOVER=\"over('"<>wstat<>"')\" ONMOUSEOUT=\"out()\">"<> "\"Previous\"
ToString[mpics0]<> "\" WIDTH=\"310\">year<>"/"<>roll<>"/montage1.jpg\" BORDER=\"0\" WIDTH=\"310\" HEIGHT=\""<> ToString[pheight]<>"\" ALT=\"Column of "<>ToString[mpics0]<>" large thumbnails of pictures\" USEMAP=\"#browser\">"//p; description[year,roll,pics0[[1]]]//p; "
"//p; description[year,roll,pics0[[npic]]]//p; "
ref<>"\" ONMOUSEOVER=\"over('"<>wstat<>"')\" ONMOUSEOUT=\"out()\">"<> "\"Next\"
"//p; ""//p; "

"//p; ""//p; "
"//p; ""//p; ""//p; ""//p; ""//p; "
"//p; "Compact photomontage |"//p; Do[year1=years[[nyear1]]; "year1<>"/list.htm\" ONMOUSEOVER=\"over('Index of pictures taken in "<>year1<>" ("<> ToString[mmpics[year1]]<>" pictures in "<>ToString[mrolls[year1]]<> " rolls of film)')\" ONMOUSEOUT=\"out()\">"<>year1<>" |"//p; ,{nyear1,myears}]; "years[[1]]<>" - "<>years[[myears]]<>"')\" ONMOUSEOUT=\"out()\">Index |"//p; "ToString[mmmpics]<> " pictures in "<>ToString[mmrolls]<>" film rolls, for "<>ToString[myears]<> " years')\" ONMOUSEOUT=\"out()\">Full List |"//p; "Selected Pict."//p; "
"//p; ""//p; "


"//p; "Home page"//p; ""//p; If[!firstroll, ""//p]; If[!lastroll, ""//p]; "

"//p; fcolors=ToFileName[{dir0,"compress",year,roll},"colors.dat"]; cdata=ReadList[fcolors,{Word,Number,Number,Number,Number,Number}]; mcdata=Length[cdata]; Do[{pic,x,y,r,g,b}=cdata[[n]]; picsize[pic]=ToString[x]<>"x"<>ToString[y]; ,{n,mcdata}]; Do[pic=pics0[[npic]]; href="jpeg"<>"/"<>pic; href1="../../"<>year<>"/"<>roll<>"/"<>href; psize=picsize[pic]; sz=Floor[FileByteCount[ToFileName[{dir0,year,roll,"jpeg"},pic]]/1000]; wstat="Click to see full size picture "<>psize<>", "<>ToString[sz]<>" KB"; x11=0; y11=260(npic-1); x22=310; y22=260 npic; coor=ToString[x11]<>","<>ToString[y11]<>","<>ToString[x22]<>","<>ToString[y22]; "coor<>"\" href=\""<>href<>"\" ONMOUSEOVER=\"over('"<>wstat<>"')\" ONMOUSEOUT=\"out()\" ONCLICK=\"return launchViewer('"<> href1<>"',"<>StringReplace[psize,"x"->","]<>")\">"//p; ,{npic,mpics0}]; "

"//p; ""//p; ""//p; Close[of]; ,{nroll,mmrolls}];