Add image in Jira with a plugin VM file

Youssef Bouchara January 12, 2022

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
Jack Nolddor _Sweet Bananas_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 14, 2022

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