Greetings JIRA plugin developers,
I have been looking for a couple of days for an answer to this question but to no avail.
In a plugin I am writing I need to be able upload images after the plugin has been installed, store them and then be able to access them with a URL so they can be presented at a different point in the plugin. I have already achieved the storage of the image in a JIRA_HOME/data/{mypluginfolder} directory. I can see the uploaded images in this folder on my local developer instance of JIRA, but I have no ideas how to make the images accessible to the JIRA user/plugin so they can presented/retrieved. I have thought about making a rest call that would fetch the images and present them, but I understand that solution would be very memory consuming. Does anyone have any suggestions on how to do what I am trying to achieve?
Community moderators have prevented the ability to post new answers.
I resolve this problem by that way:
- Upload image -> store image in JIRA HOME -> read image from JIRAHOME -> return it to client via REST
if (FileUtil.isImage(image)) {
String subType = FileUtil.getFileExtension(fileName);
return Response.ok(image).type(new MediaType("image", subType)).build();
}
Hi Matthías,
Have you tried to define a downloadable directory in your atlassian-plugin.xml? This doc is for Bamboo but should work with JIRA as well.
If your plugin requires a lot of resources, you may wish to expose a directory of files as resources, rather than writing definitions for each individual file.
<resource type="download" name="icons/" location="templates/extra/autofavourite/icons/"/>
- The
name
andlocation
must both have trailing slashes- Subdirectories are also exposed, so in the example above,
icons/small/icn_auto_fav.gif
will be mapped to the resourcetemplates/extra/autofavourite/icons/small/icn_auto_fav.gif
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Greetings Vitalii, I wasn't aware that I could access and alter a resource folder after the plugin has been installed. I need to be able to upload content to the folder at any point after the plugin's installation. If it is possible I can clearly see how this would be a good solution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Matthías, have you solved this problem? I have the same aim. I've tried the solution proposed by Vitalii Petrychuk but it doesn't work! Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Matthías, have you solves this probleam? I have the same probleam. I try to find a lot of way but it doesn't work. Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any updates on this? I have the same trouble to get this done...
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.