Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,501,111
Community Members
 
Community Events
179
Community Groups

JIRA Plugin Development | How to import image file on velocity file.

Hi Atlassian Answers,

I'm trying to make jira plugin. I want to image file in my velocity files but I couldn't do it.

The following is my way about it. Please, tell me how to import image files.

■atlassian-plugin.xml

<web-panel ...>

<resource name="view" type="velocity" location="post-to-yammer-button.vm" />

<resource type="download" name="images/" location="images/yam_btn.gif"/>

</web-panel>

■post-to-yammer-button.vm

...

<img src="images/yam_btn.gif">

...

■src path

dev-posttoyammer/src/main/resources/images/yam_btn.gif

(plugin home directory is dev-posttoyammer)

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

4 votes
Answer accepted
ConradR Rising Star Jan 27, 2013

This should work:

&lt;resource type="download" name="images/" location="images/"/&gt;
&lt;img src="$req.contextPath/download/resources/PLUGIN_KEY:RESOURCE_KEY/images/yam_btn.gif"&gt;

■pom.xml

&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
	&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
	&lt;groupId&gt;dev.posttoyammer&lt;/groupId&gt;
	&lt;artifactId&gt;dev-posttoyammer&lt;/artifactId&gt;
	&lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
	&lt;organization&gt;
		&lt;name&gt;&lt;/name&gt;
		&lt;url&gt;&lt;/url&gt;
	&lt;/organization&gt;
	&lt;name&gt;Post-To-Yammer-Plugin&lt;/name&gt;
	&lt;description&gt;This plugin set up "post to yammer button" on issue page.&lt;/description&gt;
	&lt;packaging&gt;atlassian-plugin&lt;/packaging&gt;
	&lt;dependencies&gt;
		&lt;dependency&gt;
			&lt;groupId&gt;com.atlassian.jira&lt;/groupId&gt;
			&lt;artifactId&gt;jira-api&lt;/artifactId&gt;
			&lt;version&gt;${jira.version}&lt;/version&gt;
			&lt;scope&gt;provided&lt;/scope&gt;
		&lt;/dependency&gt;
	
	...
	
		&lt;properties&gt;
		&lt;jira.version&gt;5.0&lt;/jira.version&gt;
		&lt;amps.version&gt;3.11&lt;/amps.version&gt;
	&lt;/properties&gt;
&lt;/project&gt;

■post-to-yammer-button.vm

&lt;img src="$req.contextPath/download/resources/dev.posttoyammer.dev-posttoyammer:post-to-yammer-button/images/yam_btn.gif" /&gt;

Hi Conrad,

Thank you for your reply. I tried to modify with your advice but I couldn't work it. Where is my misstake?

■atlassian-plugin.xml

&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;atlassian-plugin key="${project.groupId}.${project.artifactId}"
	name="${project.name}" plugins-version="2"&gt;
	&lt;plugin-info&gt;
		&lt;description&gt;${project.description}&lt;/description&gt;
		&lt;version&gt;${project.version}&lt;/version&gt;
		&lt;vendor name="${project.organization.name}" url="${project.organization.url}" /&gt;
	&lt;/plugin-info&gt;
	


	&lt;web-panel name="PostToYammerButton" i18n-name-key="post-to-yammer-button.name"
		key="post-to-yammer-button" location="atl.jira.view.issue.right.context"
		weight="1000"&gt;
		&lt;description key="post-to-yammer-button.description"&gt;The PostToYammerButton Plugin
		&lt;/description&gt;
		 &lt;context-provider class="authe.IssueInfoProvider"/&gt;
		&lt;resource name="view" type="velocity" location="post-to-yammer-button.vm" /&gt;
		&lt;label key="post-to-yammer-button.title" /&gt;
		&lt;resource type="download" name="images/" location="images/"/&gt;
	&lt;/web-panel&gt;
	&lt;resource type="i18n" name="i18n" location="atlassian-plugin" /&gt;

&lt;/atlassian-plugin&gt;

ConradR Rising Star Jan 27, 2013

Hm, I don't know. This works for me in a project-tabpanel. Did you deploy the plugin after your changes in atlassian-plugin.xml? What is the URL of the image and the return code?

Hi all, I'm facing the exact same issue. Please post, if you got the solution.

TAGS
AUG Leaders

Atlassian Community Events