Where can I store images (uploaded via plugin) and make them available with a URL in a plugin?

Dang Thi Thuy Tien
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.
November 19, 2018

I wrote a plugin. It has function for upload image and show image it via URL.

I uploaded the image and store it in the (tomcat of jira : ../../container/tomcat8x/cargo-jira-home/webapps/jira/images) then the image can be access via URL .../jira/secure/imageName.jpg

But I wonder if the image stored in tomcat is properly right way? 

I find so way to store an image in the {JIRA_HOME}/data/... But I don't no the way to access the image via URL.

Does anybody know how to access the image in {JIRA_HOME} via URL? 

1 answer

0 votes
IgorUkolov February 18, 2019

I have the same question. Any answer on that??

Dang Thi Thuy Tien
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.
February 19, 2019

Hi @IgorUkolov,

I resolve this problem by that way:

- Upload image -> store image in JIRA HOME  -> read image from JIRAHOME -> return it to the client via REST 

if (FileUtil.isImage(image)) {
String subType = FileUtil.getFileExtension(fileName);
return Response.ok(image).type(new MediaType("image", subType)).build();
}
IgorUkolov February 19, 2019

@Dang Thi Thuy Tien thanks a lot! Do you know how to don't mark resource as attachment? In other words, I don't want download dialog when I'm trying to access an image via url, I want to show image instead...

IgorUkolov February 19, 2019

@Dang Thi Thuy Tien Sorry, I just passed a wong content type! Thank you once again!

Suggest an answer

Log in or Sign up to answer