Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

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

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;

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
Community showcase
Published in Confluence

⚡️NEW Group for Confluence Cloud Admins

Calling all Confluence Cloud Admins!  We created a new Community Group to support your unique needs as Confluence admins. This is a group where you can ask questions, access resou...

34 views 1 3
Read article

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