title: How to load an image using its real path in Grails
body: <p>My idea is to save the images which the user uploads outside the context path as follow:</p>
  
  <pre><code>D:\somefolder\myWeb\web-app\
  D:\somefolder\imagesOutsideContextPath\
  </code></pre>
  
  <p>The code for that is the next (working locally):</p>
  
  <pre><code>String path = servletContext.getRealPath("/"); 
  String parentFolder = new File(path).getParentFile().getParent();
  String imagesFolder = parentFolder + "\\imagesOutsideContextPath";
  </code></pre>
  
  <p>Another idea (if this one doesn't work on server) would be to save the images in the current user's home folder as <a href="https://stackoverflow.com/questions/17976322/how-to-configure-grails-to-avoid-deletion-of-uploaded-images-when-redeploy-in-a">@HoàngLong suggested me</a>.</p>
  
  <p>But I'm not able to load the images from the view. I think <a href="http://grails.org/doc/1.4.x/ref/Tags/img.html" rel="nofollow noreferrer">this article from official documentation</a> is not valid for that purpose. <strong>The next code desn't load anything:</strong></p>
  
  <pre><code>&lt;img src="D:\\somefolder\\imagesOutsideContextPath\\bestImageEver.jpg" alt="if I don't see this message, I'll be happier"&gt;
  </code></pre>
  
  <p>How could I use the real path instead the an url path to load these images?</p>