home *** CD-ROM | disk | FTP | other *** search
- function GeneratePreview(cSourcePath, cDestPath, cID)
- {
- //MessageBox("cSourcePath = " + cSourcePath + "\ncDestPath = " + cDestPath + "\ncID = " + cID, "Preview", MB_OK);
- }
-
- function GetImagePageFileName(iImg) {
- return "img" + IntToStr(iImg, 5) + ".htm";
- }
-
- function GenerateAlbum(cSourcePath, cDestPath)
- {
- var iFilesCount = lSelectedFiles.GetCount();
- var iRows = Math.ceil(iFilesCount/iCols);
-
- var tAlbum = new CTemplate();
- tAlbum.Load(cSourcePath + "album.tpl", 0);
-
- tAlbum.SetReplace("${TITLE}", cTitle);
- tAlbum.SetReplace("${BGCOLOR}", iBgColor);
- tAlbum.SetReplace("${FOOTER}", ReplaceExifStrings(cFooter, "", ""));
- tAlbum.SetReplace("${ALBUM_NAME}", cAlbumName);
- tAlbum.SetReplace("${FONT_SIZE}", cFontSize);
-
- var tRow = new CTemplate();
- tRow.Load(cSourcePath + "row.tpl", 0);
-
- var tCol = new CTemplate();
- tCol.Load(cSourcePath + "col.tpl", 0);
-
- var cRows = "";
- var cCols = "";
-
- var iMaxWidth = 0;
-
- var iImgs = 1;
- for (var iRow = 0; iRow < iRows; iRow++) {
- cCols = "";
- for (var iCol = 0; iCol < iCols; iCol++) {
- if (iImgs <= iFilesCount) {
- cFileName = lSelectedFiles.GetAt(iImgs-1);
- cTNFileName = "tn" + IntToStr(iImgs, 5) + ".jpg";
- cImgFileName = "img" + IntToStr(iImgs, 5) + ".jpg";
-
- var pImg = new CImage();
- pImg.Load(cFileName, 0);
-
- // if (pImg.GetImageFormat() != JPGformat) {
- // pImg.SaveAs(cDestPath + cImgFileName, JPGformat, 80, 0);
- // } else {
- CopyFile(cFileName, cDestPath + cImgFileName, FIL_OM_OVERWRITE);
- // }
-
- pImg.Resize(iTNWidth, iTNHeight, GFX_KEEP_ASPECT | GFX_INTERPOLATE);
- pImg.SaveAs(cDestPath + cTNFileName, JPGformat, iTNJPEG, 0);
-
- tCol.SetReplace("${IMG_FILENAME}", cImgFileName);
- tCol.SetReplace("${TN_FILENAME}", cTNFileName);
- tCol.SetReplace("${TN_WIDTH}", pImg.GetWidth());
- tCol.SetReplace("${TN_HEIGHT}", pImg.GetHeight());
-
- cCols += tCol.Replace();
-
- if (pImg.GetWidth() > iMaxWidth) {
- iMaxWidth = pImg.GetWidth();
- }
-
- pImg.Close();
-
- } else {
- cCols += "<td></td>";
- }
-
- iImgs++;
- }
-
- tRow.SetReplace("${COLS}", cCols);
- cRows += tRow.Replace();
-
- }
-
- cCols = "";
- for (var iCol = 0; iCol < iCols; iCol++) {
- cCols += "<td width=\""+iMaxWidth+"\"></td>";
- }
- tRow.SetReplace("${COLS}", cCols+"\n");
- cRows += tRow.Replace();
-
- tAlbum.SetReplace("${ROWS}", cRows);
-
- SaveString(cDestPath + "index.htm", tAlbum.Replace(), 0);
-
- return cDestPath + "index.htm";
-
- }
-
- INIT_OK;
-