diff --git a/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java b/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java index 7c72743d..bdc2031a 100644 --- a/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java +++ b/wise-webapp/src/main/java/com/wisemapping/controller/ExportController.java @@ -25,6 +25,7 @@ import com.wisemapping.view.MindMapBean; import com.wisemapping.exporter.ExportProperties; import com.wisemapping.filter.UserAgent; import org.apache.batik.transcoder.TranscoderException; +import org.jetbrains.annotations.NotNull; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException; @@ -106,14 +107,14 @@ public class ExportController extends BaseMultiActionController { return null; } - private void setBaseBaseImgUrl(ExportFormat format, ExportProperties properties) { + private void setBaseBaseImgUrl(ExportFormat format, @NotNull ExportProperties properties) { final String baseUrl; if (format == ExportFormat.SVG) { baseUrl = "http://www.wisemapping.com/images"; } else { final ServletContext servletContext = this.getServletContext(); - baseUrl = "file://" + servletContext.getRealPath("/images/"); + baseUrl = "file://" + servletContext.getRealPath("/icons/"); } properties.setBaseImagePath(baseUrl); } diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/SvgExporter.java b/wise-webapp/src/main/java/com/wisemapping/exporter/SvgExporter.java index db8e9602..320fb18d 100644 --- a/wise-webapp/src/main/java/com/wisemapping/exporter/SvgExporter.java +++ b/wise-webapp/src/main/java/com/wisemapping/exporter/SvgExporter.java @@ -187,13 +187,18 @@ public class SvgExporter { Element elem = (Element) node; // Cook image href ... - String imgName = elem.getAttribute("href"); - int index = imgName.lastIndexOf("/"); + final String imgUrl = elem.getAttribute("href"); + int index = imgUrl.lastIndexOf("/"); elem.removeAttribute("href"); - if (index != -1) - { - imgName = imgName.substring(index); - final String imgPath = imgBaseUrl + imgName; + if (index != -1) { + final String iconName = imgUrl.substring(index); + // Hack for backward compatibility . This can be removed in 2012. :) + String imgPath; + if (imgUrl.contains("images")) { + imgPath = imgBaseUrl + "../images/" + imgUrl; + } else { + imgPath = imgBaseUrl + imgUrl; + } elem.setAttribute("xlink:href", imgPath); } } @@ -231,7 +236,7 @@ public class SvgExporter { final NodeList groupChildren = node.getChildNodes(); for (int idx = 0; idx < groupChildren.getLength(); idx++) { final Node rectNode = groupChildren.item(idx); - float curentHeight = 0 ; + float curentHeight = 0; float curentWidth = 0; // If has a rect use the rect to calcular the real width of the topic