Quantcast

Resources plugin: question about <r:img> use

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Resources plugin: question about <r:img> use

benfreefly
I'm trying to leverage the latest version of the Resources plugin in my application, but I'm confused about ad-hoc use of the <r:img> tag.

The images are served by Apache (we are using the Apache-Tomcat connector) and are located in the "images" directory relative to the server root.  Up until this point, img tags in templates have worked fine with the format:
<img src="/images/somedir/someimage.gif"/>

However, if I use
<r:img uri="/images/somedir/someimage.gif"/>
 I get an error such as:

org.codehaus.groovy.runtime.InvokerInvocationException: java.io.FileNotFoundException: Cannot locate resource [/images/somedir/someimage.gif]

Does the resources plugin only look for images in web-app/ when using <r:img>, or is there something else I'm missing? Any help would be appreciated.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Resources plugin: question about <r:img> use

lucastex
Ben,

You'll use r:img if you use tomcat to serve images...
The plugin will not work on images that are being served outside (apache).

We use it to serve application images, layout images, and css refered images...
Other images that user upload, (that is stored outside web-app) are served directly, and not by the app (and plugin).

[]s,


Lucas Frare Teixeira .·.
- [hidden email]
- lucastex.com.br
- blog.lucastex.com
- twitter.com/lucastex


On Sun, Jan 2, 2011 at 8:46 PM, benfreefly <[hidden email]> wrote:

I'm trying to leverage the latest version of the Resources plugin in my
application, but I'm confused about ad-hoc use of the <r:img> tag.

The images are served by Apache (we are using the Apache-Tomcat connector)
and are located in the "images" directory relative to the server root.  Up
until this point, img tags in templates have worked fine with the format
/images/somedir/someimage.gif .

However, if I use <r:img uri="/images/somedir/someimage.gif"/> I get an
error such as:

org.codehaus.groovy.runtime.InvokerInvocationException:
java.io.FileNotFoundException: Cannot locate resource
[/images/somedir/someimage.gif]

Does the resources plugin only look for images in web-app/ when using
<r:img>, or is there something else I'm missing? Any help would be
appreciated.
--
View this message in context: http://grails.1312388.n4.nabble.com/Resources-plugin-question-about-r-img-use-tp3171347p3171347.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Resources plugin: question about <r:img> use

benfreefly
Thanks for the info.  Just to clarify, when you say "use tomcat to serve images" do you mean r:img can only be used with images that are packaged with the war built by grails?  Or is it possible to have another application in Tomcat whose only purpose is to serve images and the grails app could access those as well?

Lucas F. A. Teixeira wrote
Ben,

You'll use r:img if you use tomcat to serve images...
The plugin will not work on images that are being served outside (apache).

We use it to serve application images, layout images, and css refered
images...
Other images that user upload, (that is stored outside web-app) are served
directly, and not by the app (and plugin).
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Resources plugin: question about <r:img> use

Sebastian Hohns
you can leave them out of the war if you use a virtual directory. Something like

<Context path=”/myimages” docBase=”/home/web/myimages” debug=”0″ privileged=”true”>
</Context>

in your resources.xml should work together with the plugin, without a second deployed app.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Resources plugin: question about <r:img> use

benfreefly
Well I thought this had fixed the issue, but it turns out someone had changed my r:img tags back to just img on our testing server.  So, I'm back to square one here.  I do have a virtual directory for the images (although declared in tomcat's server.xml rather than resources.xml), but the resources plugin still seems to be unable to access them. Any other thoughts?

Sebastian Hohns wrote
you can leave them out of the war if you use a virtual directory. Something like

<Context path=”/myimages” docBase=”/home/web/myimages” debug=”0″ privileged=”true”>
</Context>

in your resources.xml should work together with the plugin, without a second deployed app.
Loading...