It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How I can add a image in a servlet with velocity template?

I want to add some images in my velocity templates.

Add first I add the image in the atlassian-plugin.xml file:

<web-resource key="XUserProfilePlugin-resources" name="XUserProfilePlugin Web Resources"> <dependency>com.atlassian.auiplugin:ajs</dependency>
		 <!--  IMAGES -->
		 <resource type="download" name="test.jpg" location="/images/test."/>

        <context>XUserProfilePlugin</context>
    </web-resource>

Now I want to now, how i must add this image in the velocity template? 

2 answers

1 accepted

If you don't want to mess up with ugly urls and versions, I would suggest adding a css-file to your web resource and make a div in your velocity and embedd the image via a backgroundimage

or

use base64-encoding to embed the image directly to your template.

or

you can use the url to the image

$req.contextPath/download/resources/my.plugin.key:my-module-key/path/to/image.png

But if you change the plugin key or the module, you always need to rember to change the path to the image...

Thanks a lot. It works!

Somebody there who can help me?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in United States

One week from next event!

We're having breakfast next Monday at 8AM.  We'd love to see you all come out!  Details and RSVP can be found at:   https://aug.atlassian.com/events/details/atlassian-boise-present...

19 views 0 0
View post

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you