Mercurial > hg > digilib
annotate client/digitallibrary/ImgInfo-json.jsp @ 876:eceabe0126bb jquery
trying to fix getFullscreenImgSize for iPad.
| author | robcast |
|---|---|
| date | Tue, 22 Mar 2011 18:33:52 +0100 |
| parents | c36027f01968 |
| children |
| rev | line source |
|---|---|
| 746 | 1 <%@page language="java" |
| 751 | 2 import="digilib.io.FileOps, digilib.io.ImageFileSet, digilib.io.ImageFile, |
| 3 digilib.util.ImageSize, digilib.servlet.DigilibConfiguration" | |
| 746 | 4 contentType="application/json"%><%! |
| 5 // create DocumentBean instance for all JSP requests | |
| 6 digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); | |
| 7 | |
| 8 // initialize DocumentBean instance in JSP init | |
| 9 public void jspInit() { | |
| 10 try { | |
| 11 // set servlet init-parameter | |
| 12 docBean.setConfig(getServletConfig()); | |
| 13 } catch (javax.servlet.ServletException e) { | |
| 14 System.out.println(e); | |
| 15 } | |
| 16 } | |
| 17 %><% | |
| 18 // parsing the query | |
| 19 digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request); | |
| 20 docBean.setRequest(dlRequest); | |
| 21 // dir cache | |
| 22 digilib.servlet.DigilibConfiguration dlConfig = docBean.getDlConfig(); | |
| 23 digilib.io.DocuDirCache dirCache = (digilib.io.DocuDirCache) dlConfig.getValue("servlet.dir.cache"); | |
| 24 // get file | |
| 25 FileOps.FileClass fc = FileOps.FileClass.IMAGE; | |
| 751 | 26 ImageFileSet imgFile = (ImageFileSet) dirCache.getFile(dlRequest.getFilePath(), dlRequest.getAsInt("pn"), fc); |
| 746 | 27 |
|
747
5d3da97089bc
reading image info asynchronously works now. has just no use yet.
robcast
parents:
746
diff
changeset
|
28 %>{ <% |
| 746 | 29 if (imgFile != null) { |
| 751 | 30 ImageFile img = (ImageFile) imgFile.getBiggest(); |
| 746 | 31 ImageSize imgSize = img.getSize(); |
| 32 %> | |
| 33 "filename" : "<%= imgFile.getName() %>", | |
| 34 "aspect" : <%= imgFile.getAspect() %>, | |
| 35 "dpi_x" : <%= imgFile.getResX() %>, | |
| 36 "dpi_y" : <%= imgFile.getResY() %><% | |
| 37 | |
| 38 if (imgSize != null) { | |
| 39 %>, | |
| 40 "width" : <%= imgSize.getWidth() %>, | |
| 41 "height" : <%= imgSize.getHeight() %> | |
| 42 <% } | |
| 43 } | |
| 44 %>} |
