(* Main index page *) maintainIndex := ( Print["Creating main index page ..."]; (* dates *) cdates = shootingdata["datetime", #[[1]], #[[2]]] & /@ picsList; (*Overwrite wrong dates by a date specified in the caption*) cdates1 = DateList[datedata[#[[1]], #[[2]]]] & /@ picsList; Do[cdate = cdates[[nr]]; cdate1 = cdates1[[nr]]; cdatea = Take[cdate, 3]; cdatea1 = Take[cdate1, 3]; If[cdatea =!= cdatea1, Print["Picture ", picsList[[nr]], ": Changing date: ", cdatea, " -> ", cdatea1]; cdates[[nr, 1]] = cdatea1[[1]]; cdates[[nr, 2]] = cdatea1[[2]]; cdates[[nr, 3]] = cdatea1[[3]];], {nr, Length[picsList]}]; picDates = Transpose[{picsList, cdates}]; Do[ {{r, p}, date} = picdate; picDate[r, p] = date, {picdate, picDates}]; mushyears = Union[First /@ cdates]; {tyearmin, tyearmax} = {Min[mushyears], Max[mushyears]}; (* *) {wthmaxm, hthmaxm} = {400, 300}; xsizem1 = 400; (* Max width of pop-up thumbnail *) ysizem1 = 300; (* Max height of pop-up thumbnail *) height = 270; filesample = ToFileName[{dirwork, "templates"}, "index.htm"]; checkfile[filesample]; text = Import[filesample, "Text"]; text = StringReplace[text, {"NPICTURES" -> ToString[nPictures], "MPICTURES" -> ToString[mPictures], "NNAMES" -> ToString[nNames], "NDATES" -> ToString[nDates]}]; spanRead[text]; spanNew["topline"] = toplinefix[spanOld["topline"]]; (* Paginating to several year sets *) tyearsets = Prepend[Table[{y, y}, {y, 2017, tyearmax}], {tyearmin, 2014}]; Print["Year sets for thumbnails: ", tyearsets // TableForm]; (* Main body - giant photomontage - for each year set *) body = Table[ {ymin, ymax} = tyearset; title = label = ToString[ymin]; If[ymax != ymin, title = title <> " - " <> ToString[ymax]; title1 = "Years " <> title, title1 = "Year " <> title]; tmushpics = First /@ Select[picDates, (ymin <= ToExpression[#[[2, 1]]] <= ymax) &]; Print[" --- ", title1, ": Total of ", Length[tmushpics], " pictures of Texas mushrooms."]; tmushpics = ({r, p} = #; {toyear[r], r, p})& /@ tmushpics; set = tmushpics; mset = Length[set]; thsize = 50; columns = 20; columns = Min[columns, mset]; rows = Ceiling[Length[set]/columns]; dirmont = ToFileName[{dir0, "chron"}]; checkdir1[dirmont]; filemont = ToFileName[{dirmont}, "montage" <> label <> ".jpg"]; If[FileType[filemont] =!= File || ifRefreshMont === True, maintainMontage]; nborder = 1; montagewidth = columns (thsize + 2 nborder); montageheight = rows (thsize + 2 nborder); imgmap[tyearset] = { "" } // StringJoin; "