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