<%-- Shows enlarged image of artist's artwork. TODO: - make slideshow controls contrasting with background - react on PgDn, PgUp events (next and prev artworks) - ignore any and all double clicks - Mac: Safari: fit does not fit into window - draws scrollbar - Bug: slideshow controls are not seen on dark backgrounds. - Glitch: copyright notice floats when window height increases Browser issues: PC IE Firefox Mac Safari Firefox --%> <%@ page import="javax.swing.ImageIcon" %> <%@ include file="globalPaths.jsp" %> <%@ include file="globalDefinitions.jsp" %> <% Connection connection = null; Statement statement = null; ResultSet resultSet = null; String query = null; String artwork = null; String screenshot = null; String bigshot = null; boolean bigshotExists = false; boolean bigshotExistsAmongAll = false; boolean curArtworkBigshotExists = false; String artistName = null; String server = ""; String md = "0"; String id = null; Vector artworkIDs = new Vector(); Vector screenshots = new Vector(); Vector bigshotExistss = new Vector(); int curArtworkIndex = -1; int artworkCount = 0; int width = 440; boolean slideshowOn = false; boolean slideshowAutostart = false; String mode = null; int imageWidth = 0; boolean isMagnified = false; %> <% try { artwork = request.getParameter("artwork"); if (artwork == null) { throw new UserInputException("Parameter \'Artwork\' is missing."); } // Get mode parameter. Mode parameter is either 'default' // to display using zoom settings as they are remembered in cookies, // or 'fixed' or 'magnified', to display picture original (big size) mode = request.getParameter("mode"); if (mode == null) { mode = "default"; } if ("magnified".equals(mode) || "fit".equals(mode)) { isMagnified = true; } slideshowAutostart = "start".equals(request.getParameter("slideshow")); slideshowOn = "on".equals(request.getParameter("slideshow")); connection = openConnection(); statement = connection.createStatement(); query = "SELECT W.id, W.screenshot, W.bigshot, W.widthImage," + " A.firstName, A.lastName, W.modifiedDate, Srv.httppath FROM galleryArtwork W " + " JOIN galleryArtist A ON W.artist=A.id" + " JOIN galleryArtwork W2 ON W2.id=" + quoteString(artwork) + "AND W.artist=W2.artist" + " LEFT JOIN galleryServer Srv ON W.ftpserver=Srv.id" + " WHERE W.activeflag IN ('Y', 'L', 'V') OR W.id=" + quoteString(artwork) + " ORDER BY W.sortid"; resultSet = statement.executeQuery(query); boolean onCurrentArtwork = false; while (resultSet.next()) { id = resultSet.getString("W.id"); artworkIDs.addElement(id); onCurrentArtwork = artwork.equals(id); if (onCurrentArtwork) { curArtworkIndex = artworkIDs.size() - 1; } server=resultSet.getString("Srv.httppath"); screenshot = resultSet.getString("screenshot"); if (screenshot == null) { throw new UserInputException("Incorrect value in \'Artwork\' parameter."); } // In 'magnified' mode, replace screenshots with big images (if they exist) bigshot = resultSet.getString("W.bigshot"); bigshotExists = bigshot != null && bigshot.length() > 0; bigshotExistsAmongAll = bigshotExistsAmongAll || bigshotExists; bigshotExistss.addElement(bigshotExists); if (isMagnified && bigshotExists) { screenshot = bigshot; } screenshot = server + screenshot + "?" + getTimestampDigits(resultSet, "W.modifiedDate"); screenshots.addElement(screenshot); if (onCurrentArtwork) { curArtworkBigshotExists = bigshotExists; imageWidth = resultSet.getInt("W.widthImage"); } if (resultSet.getString("A.firstName").equals("")) artistName = resultSet.getString("A.lastName"); else artistName = resultSet.getString("A.firstName") + " " + resultSet.getString("A.lastName"); } if (curArtworkIndex == -1) { throw new UserInputException("Artwork not found."); } screenshot = (String)screenshots.elementAt(curArtworkIndex); bigshotExists = curArtworkBigshotExists; artworkCount = artworkIDs.size(); resultSet.close(); } catch (UserInputException uie) { session.setAttribute("404.log", "0"); session.setAttribute("404.errorDescription", uie.getMessage()); response.sendError(response.SC_NOT_FOUND); return; } catch (Exception e) { errorLog(e, query); sendRedirect(globalErrorPage + "?errorDescription=" + URLEncoder.encode(e.getMessage())); return; } finally { if (resultSet != null) resultSet.close(); if (connection != null && !connection.isClosed()) connection.close(); } %><% String bodyBgColor = "FFFFFF"; String controlPanelToggleMode = null; String controlPanelHidden = null; Cookie[] cookies = request.getCookies(); for (int i = 0; cookies != null && i < cookies.length; i++) { Cookie cookie = cookies[i]; if (cookie.getName().equals("slideshow.background")) { bodyBgColor = cookie.getValue(); } if (cookie.getName().equals("slideshow.controlPanelToggleMode")) { controlPanelToggleMode = cookie.getValue(); } if (cookie.getName().equals("slideshow.controlPanelHidden")) { controlPanelHidden = cookie.getValue(); } } if ("auto".equals(controlPanelToggleMode) && slideshowOn) { controlPanelHidden = "true"; } String userAgent = request.getHeader("User-Agent"); boolean isMac = (userAgent != null) && (userAgent.indexOf("Mac") != -1); boolean isIE = (userAgent != null) && (userAgent.indexOf("MSIE") != -1); String mainTableHeight = isMac ? "93%" : isIE ? "94.5%" : "95%"; boolean enableMagnified = bigshotExists; if (bigshotExistsAmongAll) { // Change default width (440 px) to 550 px // since this is the standard size bigshots // are scaled down to produce 'screenshots' width = 550; } if (isMagnified && bigshotExists) { //screenshot = bigshot; // Change default width (440 px) to original width of big image width = imageWidth; } %> <%= artistName %>
                   
  75%  100%  125%  150%  200%  Fit 


" />

© <%= artistName %> 
<%@ include file="globalFinally.jsp" %>