Changeset 26180 for other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/Displays.java
- Timestamp:
- 2012-09-12T19:37:39+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/gs3-webservices-java-client/trunk/src/GS3DemoClient/org/greenstone/gs3client/Displays.java
r15222 r26180 85 85 * @param imgURL - src URL for a (web) image 86 86 * @return the imgURL parameter enclosed in complete html */ 87 public static String getImgUrlEnclosedInHtml(String imgURL)87 public static String getImgUrlEnclosedInHtml(String baseURL, String imgURL) 88 88 { 89 return "<html><head></head><body><img src=" 90 + imgURL + "></body></html>"; 89 //return "<html><head></head><body><img src=" + imgURL + "></body></html>"; // old Greenstone3 90 91 String htmlStr = "<html><head></head><body>"; 92 int index = imgURL.indexOf("<img src="); 93 if(index != -1) { // if it already contains an image tag 94 // check if it's a relative url 95 index = imgURL.indexOf("://", index + "<img src=".length()); 96 if(index == -1) { // relative, so doesn't have a file:// or http(s):// prefix 97 imgURL = imgURL.replace("<img src=\"", "<img src=\""+baseURL); 98 } 99 htmlStr += imgURL; 100 } 101 else { // Old GS3: doesn't yet contain an image tag, embed url in img tag 102 htmlStr = htmlStr + "<img src=" + imgURL + ">"; 103 } 104 htmlStr += "</body></html>"; 105 return htmlStr; 106 91 107 } 92 108 … … 220 236 if(docNode.canBeImage()) 221 237 htmlArea.setText( 222 getImgUrlEnclosedInHtml(docNode.getImgURL()));238 getImgUrlEnclosedInHtml(client.getBaseURL(), docNode.getImgURL())); 223 239 // JEditorPane does not understand <img />! So use only <img> 224 240 else { … … 227 243 // for the latest exported greenstone colllections 228 244 // into fedora, Greenstone prefixes FG in front of image name... 229 htmlArea.setText(getImgUrlEnclosedInHtml( filepath+filename));245 htmlArea.setText(getImgUrlEnclosedInHtml(client.getBaseURL(), filepath+filename)); 230 246 } 231 247
Note:
See TracChangeset
for help on using the changeset viewer.