home *** CD-ROM | disk | FTP | other *** search
/ PC World 2004 July & August / PCWorld_2004-07-08_cd.bin / Software / topware / zoner / zme6_trial_cz.exe / blue.zht / main.js < prev    next >
Encoding:
Text File  |  2004-04-20  |  18.8 KB  |  525 lines

  1. function GeneratePreview(cSourcePath, cDestPath, cID)
  2. {
  3.   //MessageBox("cSourcePath = " + cSourcePath + "\ncDestPath = " + cDestPath + "\ncID = " + cID, "Preview", MB_OK);
  4. }
  5.  
  6. function GetPageFN(iPage) {    
  7. // generovani jmena souboru s obrazkem
  8.   if (iPage == 1) {
  9.     return "index.htm";
  10.   }
  11.   return "page" + IntToStr(iPage, 5) + ".htm";
  12. }
  13.  
  14. function GetImgPageFN(iFile) {
  15. // generovani jmena indexove strany
  16.   return "ipage" + IntToStr(iFile, 5) + ".htm";
  17. }
  18.  
  19. function GetPagesNavigation(iPagesCount, iCurPage) {
  20. // generovani navigacniho textu mezi strankami s obrazky "1 2 3 4 5 ..."
  21.   cNavigation = "";
  22.   for (iPage=1; iPage <= iPagesCount; iPage++) {
  23.     if (iPage == iCurPage) {
  24.       cNavigation += "<B>"+IntToStr(iPage, 0)+"</B>\n";
  25.     } else {
  26.       cNavigation += "<A HREF=\""+GetPageFN(iPage)+"\">"+IntToStr(iPage, 0)+"</A>\n";
  27.     }
  28.   }
  29.   return cNavigation;
  30. }
  31.  
  32. function GetImgPagesNavigation(iFilesCount, iCurFile) {
  33. // generovani navigacniho textu pro navigaci mezi indexy "1 2 3 4 5 ..."
  34.   cNavigation = "";
  35.   for (iFile=1; iFile <= iFilesCount; iFile++) {
  36.     if (iFile == iCurFile) {
  37.       cNavigation += "<B>"+IntToStr(iFile, 0)+"</B>\n";
  38.     } else {
  39.       cNavigation += "<A HREF=\""+GetImgPageFN(iFile)+"\">"+IntToStr(iFile, 0)+"</A>\n";
  40.     }
  41.   }
  42.   return cNavigation;
  43. }
  44.  
  45. function GenerateAlbum(cSourcePath, cDestPath)
  46. {
  47.   if (bGlobalTitle)
  48.   {
  49.     cTitle    = cGlobalTitle;
  50.     cHeader    = cGlobalTitle;
  51.     cImgHeader  = cGlobalTitle;
  52.     cImgTitle    = cGlobalTitle;
  53.   }
  54.   // generovani cele html struktury
  55.   var iFilesCount = lSelectedFiles.GetCount();    // celkovy pocet souboru
  56.  
  57.   var iPagesCount = Math.ceil(iFilesCount / (iCols*iRows));  // pocet indexovych stran
  58.   
  59.   // hardwired variables (can't be set through zme dialog, but can be modified here)
  60.   var bImgMag=false;    // obrazek lupy "-" do obrazku
  61.   var bThnMag=false;    // obrazek lupy "+" do obrazku
  62.   
  63.   // blabla 
  64.   var iNavStyle = parseInt(cNavStyle);
  65.   var iNavPosition = parseInt(cNavPosition);
  66.   var iImgNavStyleTop = parseInt(cImgNavStyleTop);
  67.   var iImgNavStyleBottom = parseInt(cImgNavStyleBottom);
  68.  
  69.   var tPage = new CTemplate();
  70.   tPage.Load(cSourcePath + "page.tpl", 0);
  71.   tPage.SetReplace("${CSS_FILENAME}", "page.css");
  72.  
  73.   tPage.SetReplace("${TITLE}", cTitle);
  74.   var txtHeader="";
  75.   if (bHeader)
  76.   {
  77.     txtHeader=ReplaceExifStrings(cHeader, "", "");
  78.     txtHeader="<span class=\"header\">"+txtHeader+"</span>";
  79.   }
  80.   tPage.SetReplace("${HEADER}", txtHeader); 
  81.   
  82.   var txtBackRef="";
  83.   if (bBackRef)
  84.   {
  85.       txtBackRef="<a href=\"" + cBackRefAdr + "\">" + cBackRefText + "</a>";
  86.     var tBackNav = new CTemplate();
  87.     tBackNav.Load(cSourcePath + "img_nav_b.tpl", 0);
  88.     tBackNav.SetReplace("${NAVBACK}", txtBackRef);
  89.       txtBackRef=tBackNav.Replace();
  90.   }
  91.   tPage.SetReplace("${BACKREF}", txtBackRef);
  92.   
  93.   var txtFooter="";
  94.   if (bFooter)
  95.   {
  96.     txtFooter=ReplaceExifStrings(cFooter, "", "");
  97.     txtFooter="<p><span class=\"footer\">"+txtFooter+"</span></p>";
  98.   }
  99.   tPage.SetReplace("${FOOTER}", txtFooter); 
  100.  
  101.   var tPageCSS = new CTemplate();
  102.   tPageCSS.Load(cSourcePath + "css.tpl", 0);
  103.  
  104.   var iDescTDWidth = iThnWidth+4;
  105.   var iThnTDWidth = iThnWidth+iThnTDSpace;
  106.   var iThnTDHeight = iThnHeight+iThnTDSpace;
  107.   var iOrgTDWidth = iThnWidth+4;
  108.  
  109.   var iThnTableWidth = (iCols)*(iThnTDWidth) + (iCols+1)*(1); // (1) ... cellspacing="1"
  110.  
  111.   // nastaveni stylu pro indexovou stranku
  112.   tPageCSS.SetReplace("${BGCOLOR}", HEXColor(iBgColor));
  113.   tPageCSS.SetReplace("${HEAD_FONT_SIZE}", iHeaderFontSize);
  114.   tPageCSS.SetReplace("${HEAD_FONT_COLOR}", HEXColor(iHeaderFontColor));
  115.   tPageCSS.SetReplace("${THN_TABLE_WIDTH}", iThnTableWidth);
  116.   tPageCSS.SetReplace("${DESC_FONT_SIZE}", iDescFontSize);
  117.   tPageCSS.SetReplace("${DESC_FONT_COLOR}", HEXColor(iDescFontColor));
  118.   tPageCSS.SetReplace("${DESC_BGCOLOR}", HEXColor(iDescBgColor));
  119.   tPageCSS.SetReplace("${DESC_LINK_COLOR}", HEXColor(iDescLinkColor));
  120.   tPageCSS.SetReplace("${DESC_TD_WIDTH}", iDescTDWidth);
  121.   tPageCSS.SetReplace("${THN_TD_WIDTH}", iThnTDWidth);
  122.   tPageCSS.SetReplace("${THN_TD_HEIGHT}", iThnTDHeight);
  123.   tPageCSS.SetReplace("${ORG_TD_WIDTH}", iOrgTDWidth);
  124.   tPageCSS.SetReplace("${THN_BGCOLOR}", HEXColor(iThnBgColor));
  125.   tPageCSS.SetReplace("${ORG_FONT_SIZE}", iOrgFontSize);
  126.   tPageCSS.SetReplace("${ORG_FONT_COLOR}", HEXColor(iOrgFontColor));
  127.   tPageCSS.SetReplace("${ORG_BGCOLOR}", HEXColor(iOrgBgColor));
  128.   tPageCSS.SetReplace("${ORG_LINK_COLOR}", HEXColor(iOrgLinkColor));
  129.   tPageCSS.SetReplace("${FOOT_FONT_SIZE}", iFooterFontSize);
  130.   tPageCSS.SetReplace("${FOOT_FONT_COLOR}", HEXColor(iFooterFontColor));
  131.   tPageCSS.SetReplace("${NAV_FONT_SIZE}", iNavFontSize);
  132.   tPageCSS.SetReplace("${NAV_FONT_COLOR}", HEXColor(iNavFontColor));
  133.   tPageCSS.SetReplace("${NAV_BGCOLOR}", HEXColor(iNavBgColor));
  134.   tPageCSS.SetReplace("${NAV_TEXT_BGCOLOR}", HEXColor(iNavTextBgColor));
  135.   tPageCSS.SetReplace("${NAV_LINK_COLOR}", HEXColor(iNavLinkColor));
  136.   tPageCSS.SetReplace("${FOOTER_LINK_COLOR}", HEXColor(iFooterLinkColor));
  137.   tPageCSS.SetReplace("${BODYFONT}",cBodyFont);
  138.   tPageCSS.SetReplace("${HEADERFONT}",cHeaderFont);
  139.   tPageCSS.SetReplace("${NAV_BACK_BGCOLOR}", HEXColor(iNavBackColor));
  140.  
  141.   SaveString(cDestPath + "page.css", tPageCSS.Replace(), 0);
  142.  
  143.  
  144.   // nastaveni stylu pro stranku s obrazkem
  145.   var tImg = new CTemplate();
  146.   tImg.Load(cSourcePath + "imgpage.tpl", 0);
  147.   // nastavit referenci na style z html stranky
  148.   tImg.SetReplace("${CSS_FILENAME}", "img.css");  
  149.  
  150.   tImg.SetReplace("${TITLE}", cImgTitle); // nastaveni titulku stranky
  151.  
  152.   var tImgCSS = new CTemplate();
  153.   tImgCSS.Load(cSourcePath + "css.tpl", 0);
  154.   
  155.   var iImgDescTDWidth = iImgWidth+4;
  156.   var iImgTDWidth = iImgWidth+iImgTDSpace;
  157.   var iImgTDHeight = iImgHeight+iImgTDSpace;
  158.   var iImgOrgTDWidth = iImgWidth+4;
  159.  
  160.   var iImgTableWidth = iImgTDWidth + 2; // 2 ... 2 x cellspacing="1"
  161.  
  162.   tImgCSS.SetReplace("${BGCOLOR}", HEXColor(iImgBgColor));
  163.   tImgCSS.SetReplace("${HEAD_FONT_SIZE}", iImgHeaderFontSize);
  164.   tImgCSS.SetReplace("${HEAD_FONT_COLOR}", HEXColor(iImgHeaderFontColor));
  165.   tImgCSS.SetReplace("${THN_TABLE_WIDTH}", iImgTableWidth);
  166.   tImgCSS.SetReplace("${DESC_FONT_SIZE}", iImgDescFontSize);
  167.   tImgCSS.SetReplace("${DESC_FONT_COLOR}", HEXColor(iImgDescFontColor));
  168.   tImgCSS.SetReplace("${DESC_BGCOLOR}", HEXColor(iImgDescBgColor));
  169.   tImgCSS.SetReplace("${DESC_LINK_COLOR}", HEXColor(iImgDescLinkColor));
  170.   tImgCSS.SetReplace("${DESC_TD_WIDTH}", iImgDescTDWidth);
  171.   tImgCSS.SetReplace("${THN_TD_WIDTH}", iImgTDWidth);
  172.   tImgCSS.SetReplace("${THN_TD_HEIGHT}", iImgTDHeight);
  173.   tImgCSS.SetReplace("${ORG_TD_WIDTH}", iImgOrgTDWidth);
  174.   tImgCSS.SetReplace("${THN_BGCOLOR}", HEXColor(iImgImgBgColor));
  175.   tImgCSS.SetReplace("${ORG_FONT_SIZE}", iImgOrgFontSize);
  176.   tImgCSS.SetReplace("${ORG_FONT_COLOR}", HEXColor(iImgOrgFontColor));
  177.   tImgCSS.SetReplace("${ORG_BGCOLOR}", HEXColor(iImgOrgBgColor));
  178.   tImgCSS.SetReplace("${ORG_LINK_COLOR}", HEXColor(iImgOrgLinkColor));
  179.   tImgCSS.SetReplace("${FOOT_FONT_SIZE}", iImgFooterFontSize);
  180.   tImgCSS.SetReplace("${FOOT_FONT_COLOR}", HEXColor(iImgFooterFontColor));
  181.   tImgCSS.SetReplace("${NAV_FONT_SIZE}", iImgNavFontSize);
  182.   tImgCSS.SetReplace("${NAV_FONT_COLOR}", HEXColor(iImgNavFontColor));
  183.   tImgCSS.SetReplace("${NAV_BGCOLOR}", HEXColor(iImgNavBgColor));
  184.   tImgCSS.SetReplace("${NAV_TEXT_BGCOLOR}", HEXColor(iImgNavTextBgColor));
  185.   tImgCSS.SetReplace("${NAV_LINK_COLOR}", HEXColor(iImgNavLinkColor));
  186.   tImgCSS.SetReplace("${FOOTER_LINK_COLOR}", HEXColor(iImgFooterLinkColor));
  187.   tImgCSS.SetReplace("${NAV_BACK_BGCOLOR}", HEXColor(iNavBackColor));
  188.   tImgCSS.SetReplace("${BODYFONT}",cImgBodyFont);
  189.   tImgCSS.SetReplace("${HEADERFONT}",cImgHeaderFont);
  190.  
  191.   SaveString(cDestPath + "img.css", tImgCSS.Replace(), 0);
  192.  
  193.   var tNav = new CTemplate();
  194.   if (iNavStyle == 1) {
  195.     tNav.Load(cSourcePath + "nav_1.tpl", 0);
  196.   }
  197.   if (iNavStyle == 2) {
  198.     tNav.Load(cSourcePath + "nav_2.tpl", 0);
  199.   }
  200.  
  201.   var tImgNavTop = new CTemplate();
  202.   if (iImgNavStyleTop == 1) {
  203.     tImgNavTop.Load(cSourcePath + "img_nav_1.tpl", 0);
  204.   }
  205.   if (iImgNavStyleTop == 2) {
  206.     tImgNavTop.Load(cSourcePath + "img_nav_2.tpl", 0);
  207.   }
  208.   if (iImgNavStyleTop == 3) {
  209.     tImgNavTop.Load(cSourcePath + "img_nav_3.tpl", 0);
  210.   }
  211.   var tImgNavBottom = new CTemplate();
  212.   if (iImgNavStyleBottom == 1) {
  213.     tImgNavBottom.Load(cSourcePath + "img_nav_1.tpl", 0);
  214.   }
  215.   if (iImgNavStyleBottom == 2) {
  216.     tImgNavBottom.Load(cSourcePath + "img_nav_2.tpl", 0);
  217.   }
  218.   if (iImgNavStyleBottom == 3) {
  219.     tImgNavBottom.Load(cSourcePath + "img_nav_3.tpl", 0);
  220.   }
  221.  
  222.   var tRow = new CTemplate();
  223.   tRow.Load(cSourcePath + "row.tpl", 0);
  224.  
  225.   var tImgRow = new CTemplate();
  226.   tImgRow.Load(cSourcePath + "row.tpl", 0);
  227.  
  228.   var tDescCol = new CTemplate();
  229.   if (bDesc)
  230.   {
  231.     tDescCol.Load(cSourcePath + "desc_col.tpl", 0);
  232.   }
  233.  
  234.   var tImgDescCol = new CTemplate();
  235.   if (bImgDesc)
  236.   {
  237.     tImgDescCol.Load(cSourcePath + "desc_col.tpl", 0);
  238.   }
  239.  
  240.   var tThnCol = new CTemplate();
  241.   tThnCol.Load(cSourcePath + "img_col.tpl", 0);
  242.  
  243.   var tImgCol = new CTemplate();
  244.   tImgCol.Load(cSourcePath + "img_col.tpl", 0);
  245.  
  246.   var tOrgCol = new CTemplate();
  247.   tOrgCol.Load(cSourcePath + "org_col.tpl", 0);
  248.  
  249.   var tImgOrgCol = new CTemplate();
  250.   tImgOrgCol.Load(cSourcePath + "org_col.tpl", 0);
  251.  
  252.   var pMagImg0 = new CImage();
  253.   pMagImg0.Load(cSourcePath + "magnify-.png", 0);
  254.  
  255.   var pMagImg1 = new CImage();
  256.   pMagImg1.Load(cSourcePath + "magnify+.png", 0);
  257.  
  258.   var cRows = "";
  259.   var cDescCols = "";
  260.   var cImgCols = "";
  261.   var cOrgCols = "";
  262.  
  263.   var iCol = 0;
  264.   var iRow = 0;
  265.   var iPage = 1;
  266.  
  267.   var iImgFrom = 1;
  268.   var iImgTo = 1;
  269.  
  270. //  for (var iFile = 1; ((iFile <= iFilesCount) || (iCol != 0) || (iRow != 0)); iFile++) {
  271.   for (var iFile = 1; ((iFile <= iFilesCount) || (iCol != 0)); iFile++) {
  272.     if (iFile <= iFilesCount) {
  273.  
  274. // FILE 
  275.       iImgTo = iFile;
  276.       cFileName = lSelectedFiles.GetAt(iFile-1);
  277.       cThnFileName = "thn" + IntToStr(iFile, 5) + ".jpg";
  278.       cImgFileName = "img" + IntToStr(iFile, 5) + ".jpg";
  279.       cOrgFileName = "org" + IntToStr(iFile, 5) + ".jpg";
  280.  
  281. // LOAD FILE
  282.       var pImg = new CImage();
  283.       pImg.Load(cFileName, 0);
  284.  
  285. // MAKE IMAGE
  286.       if (bImgUseOriginal)
  287.     {
  288.         CopyFile(cFileName, cDestPath + cImgFileName, FIL_OM_OVERWRITE);
  289.     }
  290.     else
  291.     {
  292.         pImg.Resize(iImgWidth, iImgHeight, GFX_KEEP_ASPECT | GFX_INTERPOLATE);
  293.           var rcMag = pMagImg0.GetRect();
  294.           if (bImgMag) {
  295.             pMagImg0.Draw(pImg, rcMag, pImg.GetWidth()-rcMag.Width()-1, pImg.GetHeight()-rcMag.Height()-1, 192, GFX_KEEP_ALPHA);
  296.           }
  297.           pImg.SaveAs(cDestPath + cImgFileName, JPGformat, iImgJPEG, 0);
  298.     }
  299.  
  300. // IMAGE HEADER
  301.       var txtImgHeader="";
  302.       if (bImgHeader)
  303.       {
  304.         txtImgHeader=ReplaceExifStrings(cImgHeader, cFileName, cDestPath + cImgFileName);
  305.          txtImgHeader="<span class=\"header\">"+txtImgHeader+"</span>";
  306.       }
  307.       tImg.SetReplace("${HEADER}", txtImgHeader); 
  308.  
  309. // IMAGE NAVIGATION
  310.       // navigation on top
  311.       if (iFile > 1) {
  312.         tImgNavTop.SetReplace("${NAV_FIRST}", "<a href=\""+GetImgPageFN(1)+"\">|<</a>");
  313.         tImgNavTop.SetReplace("${NAV_PREV}", "<a href=\""+GetImgPageFN(iFile-1)+"\"><<</a>");
  314.       } else {
  315.         tImgNavTop.SetReplace("${NAV_FIRST}", "|<");
  316.         tImgNavTop.SetReplace("${NAV_PREV}", "<<");
  317.       }
  318.       if (iFile < iFilesCount) {
  319.         tImgNavTop.SetReplace("${NAV_NEXT}", "<a href=\""+GetImgPageFN(iFile+1)+"\">>></a>");
  320.         tImgNavTop.SetReplace("${NAV_LAST}", "<a href=\""+GetImgPageFN(iFilesCount)+"\">>|</a>");
  321.       } else {
  322.         tImgNavTop.SetReplace("${NAV_NEXT}", ">>");
  323.         tImgNavTop.SetReplace("${NAV_LAST}", ">|");
  324.       }
  325.       if (iImgNavStyleTop == 1) {
  326.         tImgNavTop.SetReplace("${NAV_IMG}", iFile);
  327.         tImgNavTop.SetReplace("${NAV_IMGS}", iFilesCount);
  328.       } else {
  329.         tImgNavTop.SetReplace("${NAV_NAV}", GetImgPagesNavigation(iFilesCount, iFile));
  330.       }
  331.       if (iImgNavStyleTop==3)
  332.       {
  333.         tImgNavTop.SetReplace("${NAV_TEXT}", ReplaceExifStrings(cImgNavUsrText, cFileName, cDestPath + cImgFileName));
  334.       }
  335.       // bottom navigation
  336.       if (iFile > 1) {
  337.         tImgNavBottom.SetReplace("${NAV_FIRST}", "<a href=\""+GetImgPageFN(1)+"\">|<</a>");
  338.         tImgNavBottom.SetReplace("${NAV_PREV}", "<a href=\""+GetImgPageFN(iFile-1)+"\"><<</a>");
  339.       } else {
  340.         tImgNavBottom.SetReplace("${NAV_FIRST}", "|<");
  341.         tImgNavBottom.SetReplace("${NAV_PREV}", "<<");
  342.       }
  343.       if (iFile < iFilesCount) {
  344.         tImgNavBottom.SetReplace("${NAV_NEXT}", "<a href=\""+GetImgPageFN(iFile+1)+"\">>></a>");
  345.         tImgNavBottom.SetReplace("${NAV_LAST}", "<a href=\""+GetImgPageFN(iFilesCount)+"\">>|</a>");
  346.       } else {
  347.         tImgNavBottom.SetReplace("${NAV_NEXT}", ">>");
  348.         tImgNavBottom.SetReplace("${NAV_LAST}", ">|");
  349.       }
  350.       if (iImgNavStyleBottom == 1) {
  351.         tImgNavBottom.SetReplace("${NAV_IMG}", iFile);
  352.         tImgNavBottom.SetReplace("${NAV_IMGS}", iFilesCount);
  353.       } else {
  354.         tImgNavBottom.SetReplace("${NAV_NAV}", GetImgPagesNavigation(iFilesCount, iFile));
  355.       }
  356.       if (iImgNavStyleBottom==3)
  357.       {
  358.         tImgNavBottom.SetReplace("${NAV_TEXT}", ReplaceExifStrings(cImgNavUsrText, cFileName, cDestPath + cImgFileName));
  359.       }
  360.  
  361.       tImg.SetReplace("${NAVTOP}", tImgNavTop.Replace());
  362.       tImg.SetReplace("${NAVBOTTOM}", tImgNavBottom.Replace());
  363.  
  364. // IMAGE TABLE
  365.       tImgDescCol.SetReplace("${IMG_DESC}", ReplaceExifStrings(cImgDesc, cFileName, cDestPath + cImgFileName));
  366.       tImgRow.SetReplace("${DESC_COLS}", tImgDescCol.Replace());
  367.  
  368.       tImgCol.SetReplace("${IMG_PAGE_FILENAME}", GetPageFN(iPage));
  369.       tImgCol.SetReplace("${IMG_FILENAME}", cImgFileName); 
  370.       tImgCol.SetReplace("${IMG_WIDTH}", pImg.GetWidth()); 
  371.       tImgCol.SetReplace("${IMG_HEIGHT}", pImg.GetHeight()); 
  372.       tImgRow.SetReplace("${IMG_COLS}", tImgCol.Replace());
  373.  
  374.       if (bImgOriginal) {
  375.         tImgOrgCol.SetReplace("${ORG_FILENAME}", cOrgFileName);
  376.         tImgOrgCol.SetReplace("${ORG_DESC}", ReplaceExifStrings(cImgOrgDesc, cFileName, "")); 
  377.         CopyFile(cFileName, cDestPath + cOrgFileName, FIL_OM_OVERWRITE);
  378.         tImgRow.SetReplace("${ORG_COLS}", tImgOrgCol.Replace());
  379.       }
  380.       else
  381.       {
  382.         tImgRow.SetReplace("${ORG_COLS}", "<td></td>");      
  383.       }
  384.       tImg.SetReplace("${ROWS}", tImgRow.Replace());
  385.  
  386. // IMAGE FOOTER
  387.       var txtImgFooter="";
  388.       if (bImgFooter)
  389.       {
  390.         txtImgFooter=ReplaceExifStrings(cImgFooter, cFileName, cDestPath + cImgFileName);
  391.          txtImgFooter="<p><span class=\"footer\">"+txtImgFooter+"</span></p>";
  392.       }
  393.       tImg.SetReplace("${FOOTER}", txtImgFooter); 
  394.  
  395. // IMAGE SAVE
  396.       SaveString(cDestPath + GetImgPageFN(iFile), tImg.Replace(), 0);
  397.  
  398.  
  399. // MAKE THUMB
  400.       pImg.Resize(iThnWidth, iThnHeight, GFX_KEEP_ASPECT | GFX_INTERPOLATE);
  401. //BOOL CJSImage::Draw(CJSImage* pDstImage, CJSRect* pSrcRect, int iPosX, int iPosY, int iAlpha, int iFlags)
  402.       var rcMag = pMagImg1.GetRect();
  403.       if (bThnMag) {
  404.         pMagImg1.Draw(pImg, rcMag, pImg.GetWidth()-rcMag.Width()-1, pImg.GetHeight()-rcMag.Height()-1, 192, GFX_KEEP_ALPHA);
  405.       }
  406.       pImg.SaveAs(cDestPath + cThnFileName, JPGformat, iTNJPEG, 0);
  407.  
  408. // THUMB TABLE
  409.       tDescCol.SetReplace("${IMG_DESC}", ReplaceExifStrings(cDesc, cFileName, cDestPath + cImgFileName)); 
  410.       cDescCols += tDescCol.Replace();
  411.  
  412.       tThnCol.SetReplace("${IMG_PAGE_FILENAME}", GetImgPageFN(iFile));
  413.       tThnCol.SetReplace("${IMG_FILENAME}", cThnFileName);
  414.       tThnCol.SetReplace("${IMG_WIDTH}", pImg.GetWidth());
  415.       tThnCol.SetReplace("${IMG_HEIGHT}", pImg.GetHeight());
  416.       cImgCols += tThnCol.Replace();
  417.  
  418.  
  419.       if (bOriginal) {
  420.         tOrgCol.SetReplace("${ORG_FILENAME}", cOrgFileName);
  421.         tOrgCol.SetReplace("${ORG_DESC}", ReplaceExifStrings(cOrgDesc, cFileName, cFileName)); 
  422.         if (!bImgOriginal) { // if not copied in IMAGE processing
  423.           CopyFile(cFileName, cDestPath + cOrgFileName, FIL_OM_OVERWRITE);
  424.         }
  425.         cOrgCols += tOrgCol.Replace();
  426.       }
  427.  
  428.       pImg.Close();
  429.  
  430.     } else { // no other files to process, make table complete
  431.       cDescCols += "  <td class=\"img_desc_td_empty\"></td>\r\n";
  432.       cImgCols += "  <td class=\"img_td_empty\"></td>\r\n";
  433.       if (bOriginal) {
  434.         cOrgCols += "  <td class=\"img_org_td_empty\"></td>\r\n";
  435.       }
  436.     }
  437.  
  438.     iCol++;
  439.  
  440.     if (iCol >= iCols) {
  441.       if (cDescCols=="")
  442.      cDescCols="<td></td>";
  443.       if (cImgCols=="")
  444.      cImgCols="<td></td>";
  445.       if (cOrgCols=="")
  446.      cOrgCols="<td></td>";
  447.       tRow.SetReplace("${DESC_COLS}", cDescCols);
  448.       tRow.SetReplace("${IMG_COLS}", cImgCols);
  449.       tRow.SetReplace("${ORG_COLS}", cOrgCols);
  450.       cRows += tRow.Replace();
  451.  
  452.       cDescCols = "";
  453.       cImgCols = "";
  454.       cOrgCols = "";
  455.       iCol = 0;
  456.  
  457.       iRow++;
  458.     }
  459.     else
  460.     {    //bugfix? 
  461.       tRow.SetReplace("${DESC_COLS}", "<td></td>");
  462.       tRow.SetReplace("${IMG_COLS}", "<td></td>");
  463.       tRow.SetReplace("${ORG_COLS}", "<td></td>");    
  464.     }
  465.  
  466.     if ((iRow >= iRows) || ((iFile >= iFilesCount) && (iCol == 0))) {
  467.  
  468.       if (iPage > 1) {
  469.         tNav.SetReplace("${NAV_FIRST}", "<a href=\""+GetPageFN(1)+"\">|<</a>");
  470.         tNav.SetReplace("${NAV_PREV}", "<a href=\""+GetPageFN(iPage-1)+"\"><<</a>");
  471.       } else {
  472.         tNav.SetReplace("${NAV_FIRST}", "|<");
  473.         tNav.SetReplace("${NAV_PREV}", "<<");
  474.       }
  475.       if (iPage < iPagesCount) {
  476.         tNav.SetReplace("${NAV_NEXT}", "<a href=\""+GetPageFN(iPage+1)+"\">>></a>");
  477.         tNav.SetReplace("${NAV_LAST}", "<a href=\""+GetPageFN(iPagesCount)+"\">>|</a>");
  478.       } else {
  479.         tNav.SetReplace("${NAV_NEXT}", ">>");
  480.         tNav.SetReplace("${NAV_LAST}", ">|");
  481.       }
  482.       if (iNavStyle == 1) {
  483.         tNav.SetReplace("${NAV_PAGE}", iPage);
  484.         tNav.SetReplace("${NAV_PAGES}", iPagesCount);
  485.         tNav.SetReplace("${NAV_IMGFROM}", iImgFrom);
  486.         tNav.SetReplace("${NAV_IMGTO}", iImgTo);
  487.         tNav.SetReplace("${NAV_IMGS}", iFilesCount);
  488.       } else {
  489.         tNav.SetReplace("${NAV_NAV}", GetPagesNavigation(iPagesCount, iPage));
  490.       }
  491.       if (iNavPosition==1)
  492.       {
  493.           tPage.SetReplace("${NAVTOP}", tNav.Replace());
  494.         tPage.SetReplace("${NAVBOTTOM}", "");
  495.       }
  496.       if (iNavPosition==2)
  497.       {
  498.          tPage.SetReplace("${NAVTOP}", "");
  499.           tPage.SetReplace("${NAVBOTTOM}", tNav.Replace());
  500.       }
  501.       if (iNavPosition==3)
  502.       {
  503.           tPage.SetReplace("${NAVTOP}", tNav.Replace());                
  504.           tPage.SetReplace("${NAVBOTTOM}", tNav.Replace());
  505.       }
  506.       tPage.SetReplace("${ROWS}", cRows);
  507.  
  508.       SaveString(cDestPath + GetPageFN(iPage), tPage.Replace(), 0);
  509.  
  510.       cRows = "";
  511.       iRow = 0;
  512.  
  513.       iImgFrom = iFile + 1;
  514.  
  515.       iPage++;
  516.     }
  517.  
  518.   }
  519.  
  520.   return cDestPath + GetPageFN(1);
  521.   
  522. }
  523.  
  524. INIT_OK;
  525.