Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Image to Plugin VM file

Jackson Farnsworth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 26, 2018

Hey all,

 

So I'm trying to add a local image, in src/main/resources/images/ to my vm file. In my atlassian-plugin.xml, I've added it as a resource.

<web-resource key="logo" name="Logo">
<resource type="download" name="portal_logo.png" location="images/portal_logo.png" />
</web-resource>

 

In my vm file, Ive given the following:

$webResourceManager.requireResource("com.companyName.servicedesk.myPlugin:logo")
...
...
...
<img src="images/portal_logo.png" alt="Logo>

Unfortunately the image does not up with everything else. What do I need to do to fix this? Thanks in advance.

 

1 answer

0 votes
nija_kanthan August 23, 2018

 

 <img> tag src attribute value should be as follows,

$req.contextPath/download/resources/<package-name>.<plugin-name>:<resource-key><image-url>

 Example - 

<img src="$req.contextPath/download/resources/com.companyName.servicedesk.myPlugin:logo/images/portal_logo.png" alt="Logo">

Suggest an answer

Log in or Sign up to answer