BEGIN { 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; do { getline < "_index.htm"; print $0; } while ($0 != ""); do { getline < "_index.htm"; } while ($0 != ""); 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 ""; } printf ""); RowCounter--; if (RowCounter == 0) { print "
"; printf "
"); if (mPath == "") { printf "small
full "; if (Size >= 1000000) { printf ("%.0dMb ", Size / 1000000); } if ((1000000 > Size) && (Size >= 1000)) { printf ("%.0dkb ", Size / 1000); } if (Size < 1000) { printf Size "b "; } printf "
"; } else { printf "full picture

" } printf ("%s\n", UserComment "
"; RowCounter=PerRow; } } END { if (RowCounter > 0) { while (RowCounter-- > 0) { printf " "; } print ""; } print ""; print "

All these pictures full-size (" SizeSum/1000000 " Mbytes summary)\n
Picture sizes are " SizeMin " - " SizeMax " bytes;
"; print ""; do { getline < "_index.htm"; print $0; } while ($0 != ""); }