<%@ 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; } %>
Photo Gallery

(if you have photos of RV that you can share, please send us a message: click here)

- 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

View as a slideshow
<%=paging%>
<% int i = startIndex; int j; while(i <= endIndex) { %> <% j = 0; // the first pic on each row does not have a left border, hence j=0 is treated differently File file = (File) files.get(i); String name = file.getName().substring(0, file.getName().lastIndexOf("_tn.")) + ".jpg"; i++; j++; %> <% while(j < imagesPerRow && i <= endIndex) { file = (File) files.get(i); name = file.getName().substring(0, file.getName().lastIndexOf("_tn.")) + ".jpg"; i++; j++; %> <% } while(j < imagesPerRow) { j++; %> <% } %> <% if (i < endIndex) { %> <% } %> <% } %>
     
 
<%=paging%> <% // code for slide show for (int k=0; k <% } %>