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)
Community moderators have prevented the ability to post new answers.
This should work:
<resource type="download" name="images/" location="images/"/>
<img src="$req.contextPath/download/resources/PLUGIN_KEY:RESOURCE_KEY/images/yam_btn.gif">
■pom.xml
<?xml version="1.0" encoding="UTF-8"?> <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"> <modelVersion>4.0.0</modelVersion> <groupId>dev.posttoyammer</groupId> <artifactId>dev-posttoyammer</artifactId> <version>1.0-SNAPSHOT</version> <organization> <name></name> <url></url> </organization> <name>Post-To-Yammer-Plugin</name> <description>This plugin set up "post to yammer button" on issue page.</description> <packaging>atlassian-plugin</packaging> <dependencies> <dependency> <groupId>com.atlassian.jira</groupId> <artifactId>jira-api</artifactId> <version>${jira.version}</version> <scope>provided</scope> </dependency> ... <properties> <jira.version>5.0</jira.version> <amps.version>3.11</amps.version> </properties> </project>
■post-to-yammer-button.vm
<img src="$req.contextPath/download/resources/dev.posttoyammer.dev-posttoyammer:post-to-yammer-button/images/yam_btn.gif" />
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
<?xml version="1.0" encoding="UTF-8"?> <atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2"> <plugin-info> <description>${project.description}</description> <version>${project.version}</version> <vendor name="${project.organization.name}" url="${project.organization.url}" /> </plugin-info> <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"> <description key="post-to-yammer-button.description">The PostToYammerButton Plugin </description> <context-provider class="authe.IssueInfoProvider"/> <resource name="view" type="velocity" location="post-to-yammer-button.vm" /> <label key="post-to-yammer-button.title" /> <resource type="download" name="images/" location="images/"/> </web-panel> <resource type="i18n" name="i18n" location="atlassian-plugin" /> </atlassian-plugin>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all, I'm facing the exact same issue. Please post, if you got the solution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.