BEGIN {
TitleAll="SQ 24 Sep 2006 северный Речной вокзал";
PerRow=5; # Images per row in table
lPath="l/"; # Path from _index.html to large pictures
sPath="s/"; # Path from _index.html to icon pictures
# mPath=""; # default place for opening pictures is near _index.html
DimMore=602; # larger dimension of picture show window
DimLess=400; # smaller dimension of picture show window
IconMore=180; # larger dimension of picture icon window
IconLess=120; # smaller dimension of picture icon window
SizeSum=0;
SizeMin=0;
SizeMax=0;
HeightMax=0;
WidthMax=0;
print "\n
\n " TitleAll " Все снимки" >"..\\all.html";
print "\n \n " TitleAll " Лучшее" >"..\\index.html";
print "" >>"..\\all.html";
print "" >>"..\\index.html";
print " \n" >>"..\\all.html";
print " \n" >>"..\\index.html";
print " " TitleAll " Все снимки
" >>"..\\all.html";
print " " TitleAll " Лучшее
" >>"..\\index.html";
printf "Лучшее" >>"..\\all.html";
printf "Все снимки" >>"..\\index.html";
print " На уровень выше" >>"..\\index.html";
print " На уровень выше" >>"..\\all.html";
print "
" >>"..\\index.html";
print "
" >>"..\\all.html";
FS="/";
RowCounter=PerRow;
}
($4 != "") { Name=$1; Size=$2; Width=$3; Height=$4; UserComment=$5;
for (i=6; i < NF; i++) { UserComment = UserComment "/" $i ; }
sWidth=Width+16; sHeight=Height+16;
SizeSum += Size;
if ((SizeMin ==0) || (Size < SizeMin)) {SizeMin=Size;}
if ((SizeMax ==0) || (Size > SizeMax)) {SizeMax=Size;}
if ((WidthMax ==0) || (Width > WidthMax)) {WidthMax=Width;}
if ((HeightMax ==0) || (Height > HeightMax)) {HeightMax=Height;}
iW=Width; iH=Height;
iWs=0;iHs=0;
iWline="";
iHline="";
Counter=6;
while ((iW > DimMore) && (iH > DimMore) && (Counter > 0)) { iW /= 2; iH /= 2; Counter--; }
iW = int(iW); iH = int(iH);
# отклонение большей стороны от 3:2 менее 6 пикселей - считать в точности 3:2
deltaAR=Width - (Height * DimMore / DimLess);
if ((deltaAR < 6) && (deltaAR > -6)) { iW=DimMore;iH=DimLess;iWs=IconMore;iHs=IconLess;}
# отклонение большей стороны от 2:3 менее 6 пикселей - считать в точности 2:3
deltaAR=Height - (Width * DimMore / DimLess);
if ((deltaAR < 6) && (deltaAR > -6)) { iW=DimLess;iH=DimMore;iWs=IconLess;iHs=IconMore;}
# Если разница высоты и ширины менее 6 пикселей - считать квадратом
deltaAR=Height - Width;
if ((deltaAR < 6) && (deltaAR > -6)) { iW=DimMore;iH=DimMore;iWs=IconMore;iHs=IconMore;}
if ((iW > iH) && (iWs == 0)) { iWs=IconMore; iHs=IconMore*iH/iW;}
if ((iW < iH) && (iHs == 0)) { iHs=IconMore; iWs=IconMore*iW/iH;}
if ((iW == iH) && (iHs == 0)) { iHs=IconMore; iWs=IconMore;}
mPath="";
add_line=" _lister.awk";
if ((iW >= Width) && (iH >= Height)) {
mPath=lPath;
add_line="no_middle";
}
iW = int(iW);
iH = int(iH);
iWs = int(iWs);
iHs = int(iHs);
print "call _icon.bat " Name " " iW " " iH " " iWs " " iHs " " add_line >>"_lister2.bat";
if (iWs != 0) { iWline="WIDTH=\"" iWs "\""; }
if (iHs != 0) { iHline="HEIGHT=\"" iHs "\""; }
if (RowCounter == PerRow) {
print "" >>"..\\index.html";
print "" >>"..\\all.html";
}
printf ">"..\\index.html";
printf ">"..\\all.html";
printf "\" target=\"large\" onClick=\"return imgOpen(this.href," >>"..\\index.html";
printf "\" target=\"large\" onClick=\"return imgOpen(this.href," >>"..\\all.html";
printf iW "," iH ",this.target,' " UserComment " ');\">" >>"..\\index.html";
printf iW "," iH ",this.target,' " UserComment " ');\">" >>"..\\all.html";
printf " >"..\\index.html";
printf " >"..\\all.html";
printf ("%s", "ALT=\"" UserComment "\"> ") >>"..\\index.html";
printf ("%s", "ALT=\"" UserComment "\"> ") >>"..\\all.html";
if (mPath == "") {
printf "small >"..\\index.html";
printf "\" target=\"large\" onClick=\"return imgOpen(this.href," >>"..\\index.html";
printf Width "," Height ",this.target,' " UserComment " ');\"> full " >>"..\\index.html";
if (Size >= 1000000) { printf ("%.0dMb ", Size / 1000000) >>"..\\index.html"; }
if ((1000000 > Size) && (Size >= 1000)) { printf ("%.0dkb ", Size / 1000) >>"..\\index.html"; }
if (Size < 1000) { printf Size "b " >>"..\\index.html"; }
printf " " >>"..\\index.html";
printf "small picture " >>"..\\all.html";
}
else {
printf "full picture " >>"..\\index.html";
printf "full picture " >>"..\\all.html";
}
printf ("%s\n", UserComment " | ") >>"..\\index.html";
printf ("%s\n", UserComment " | ") >>"..\\all.html";
RowCounter--;
if (RowCounter == 0) {
print "
" >>"..\\index.html";
print "
" >>"..\\all.html";
RowCounter=PerRow;
}
}
END {
if (RowCounter < PerRow) {
print "" >>"..\\index.html";
print "" >>"..\\all.html";
}
print "All these pictures full-size (" SizeSum/1000000 " Mbytes summary)\n
Picture sizes are " SizeMin " - " SizeMax " bytes;" >>"..\\index.html";
print "
\n\n\n" >>"..\\index.html";
print "
\n\n\n" >>"..\\all.html";
}