%@ page import="java.io.File, java.io.FileFilter, java.util.regex.Pattern, java.util.regex.Matcher, org.rvs.web.util.Util, java.io.BufferedReader, java.io.FileReader, java.util.*, org.rvs.web.misc.FileNameCache"%> <%@ page errorPage="/misc/error.jsp" %> <% /* String uri = "/gallery/"; String path = getServletConfig().getServletContext().getRealPath(uri); File[] files1 = Util.getFilesFromDirectory(path, ".*_tn.jpg"); List files = Arrays.asList(files1); Collections.sort(files); BufferedReader in = new BufferedReader(new FileReader(path + "/captions.txt")); String line = null; HashMap map = new HashMap(); while ((line = in.readLine()) != null) { String[] parts = line.split(":"); map.put(parts[0], parts[1]); } */ List files = FileNameCache.get().getGalleryTN(); HashMap map = FileNameCache.get().getGalleryCaptions(); int currPage=1; String pageNo = request.getParameter("page"); if (pageNo != null) { currPage = Integer.parseInt(pageNo); } int imagesPerPage = 12; int imagesPerRow = 4; int totalImages = files.size(); int startIndex = (currPage-1) * imagesPerPage; int endIndex = startIndex + imagesPerPage - 1; if (endIndex >= totalImages) endIndex = totalImages - 1; int totalPages = (int) Math.ceil(((double)totalImages)/((double)imagesPerPage)); String paging = ""; if (currPage > 1) { paging = "<< page " + (currPage-1) + ""; } else { paging = "page 1"; } if (currPage < totalPages) { paging = paging + " | page " + (currPage+1) + " >>"; } else if (totalPages == 1) { paging = paging + " of 1 "; } else { paging = paging + " | page " + currPage; } %>
- position the mouse over a picture to see a description
- click a picture to see a larger image (opens in a separate window)
- sorted according to date added: most recently added photo appears first