Grails svg image href referencing png doesn't show

It is hard to explain. I needed some fillings in Coreldraw that I liked and saved as SVG . When Coreldraw saved my svg, I got one folder called soil_Images with soil_ImgID1.png inside and soil.svg . And I included the web-app/images project. For some reason, the png image is not displayed.

I have svg, as in my gsp:

 <image x="177" y="76" width="36" height="23" preserveAspectRatio="none" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/projectName/images/soil.svg"></image> 

And my soil.svg has another image tag that shows the true image that I want:

  <image x="44" y="29" width="8156" height="11707" xlink:href="soil_Images/soil_ImgID1.png"/> 

I tried to add a context path like: ${application.contextPath}/images/soil_Images/soil_ImgID1.png .
This did not work. What am I missing?

  • In chrome resources, the image is not loaded.
+5
source share
1 answer

Creating a blog post on the Matt Busche blog about using an asset pipeline with SVG and PNG backup images, try to specify the location of the resource, rather than hard-coded. Pay attention to assetPath with src (the relative path you use if not the default location of the pipeline image) and the image name.

 <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${assetPath(src: 'imgs/' + logoSVG)}" src="${assetPath(src: 'imgs/' + logoPNG)}"></image> 
0
source

All Articles