Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Add image in Jira with a plugin VM file

Edited

Hello everyone,

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

 

 <web-resource key="security-service-resources-${timestamp}" name="security-service Web Resources">

    <resource type="download" name="piechart.png" location="images/piechart.png" />

    <context>security-service</context>

  </web-resource>
and in my VM File I added this: 

$webResourceManager.requireResourcesForContext("security-service")
 <img src="$req.contextPath/download/resources/com.companyname.jira.plugin.security-service:security-service-resources-${timestamp}/images/piechart.png" alt="piechart">
I have read the documentation on how to add an external resource and did the same in here but the image still cannot be read by the browser. I get error 404 when I check the console and when I check the URL of the image I get this  

https://companyname.com/jira/download/resources/com.companyname.jira.plugin.security-service:security-service-resources-${timestamp}/images/piechart.png

1 answer

1 accepted

0 votes
Answer accepted

Hi Youssef Bouchara and welcome,

For this kind of questions exists a separate forum where developers can catch up together.
Have you tried at https://community.developer.atlassian.com/ already?

 

Regarding your questions is mostly answered already here:
https://community.atlassian.com/t5/Answers-Developer-Questions/Referencing-images-from-decorator-or-css-in-theme-plugin/qaq-p/479052

 

Probably if you dont want to use CSS but the direct link in your decorator instead, you may disable batched mode first as explained at:
https://developer.atlassian.com/server/jira/platform/web-resource/

Did my answer solve your problem?
If so, consider to mark this as an accepted answer.

Best Regards <3

Suggest an answer

Log in or Sign up to answer
TAGS

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