Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do I get the path to the images/icons folder?

Barry Britnell September 29, 2011

I'm trying to get the path to the "images/icons" folder. In my development environment, it is in /jira/webapp/images/icons folder, but that will obviously not be the path in Production. Is there a way through the API to dynamically find this path?

Thanks!

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Thuan M. Tu November 1, 2018

Images are stored in your install directory under atlassian-jira

 

{jira-install}/atlassian-jira/images/icons

0 votes
MattS
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.
September 29, 2011

See http://confluence.atlassian.com/display/CONFDEV/Adding+Plugin+and+Module+Resources about the relative location. I see two cases when I'm referring to an image resource in a .vm file. Usually:

<img src="${req.getContextPath()}/download/resources/com.consultingtoolsmiths.jira.plugins.templatehelper:templatehelper-resources/new_blink"

But in a gadget I have to use

<img src="../../../download/resources/com.consultingtoolsmiths.jira.plugins.templatehelper:templatehelper-resources/new_blink"

Hope this helps,

~Matt

0 votes
Jobin Kuruvilla [Adaptavist]
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.
September 29, 2011

In most cases, you can just use /images/icons. The resource is declared like that and so it doesn't matter what folder structure sits above it.

Barry Britnell September 29, 2011

Thanks. I've actually tried that...along with some other things, with no luck. I'm still trying, so if you have any other ideas, I would appreciate it.

Jobin Kuruvilla [Adaptavist]
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.
September 29, 2011

Are you adding your own image files? If so, you can add it as a resource in the plugin.

Barry Britnell September 29, 2011

No, I'm not. I'm just trying to get access to the icons that come loaded in JIRA by default.

For instance, the development environment path is: /webapp/images/icons.

But, in production, it will be something like: /jira/atlassian-jira-4.3/atlassian-jira/images/icons.

How do I get the "/jira/atlassian-jira-4.3/atlassian-jira" part of the URL?

Jobin Kuruvilla [Adaptavist]
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.
September 29, 2011

Ok. If you accessing from a jsp, you can do it as follows:

<img src="<%=request.getContextPath()%>/images/icons/your_image.png" alt="" title="Some title">

Basically, you invoke it using the context path in the front.

Barry Britnell September 29, 2011

Yes, I tried that. Actually, it's coming from Java code, not necessarily a JSP. My code looked like this:

String iconDirectory = JiraWebUtils.getHttpRequest().getContextPath() + File.separator + "images" + File.separator + "icons";
File iconFile = new File(iconDirectory);
String files[] = iconFile.listFiles();

But, that just gave me "/jira/images/icons" which was not what I needed.

I appreciate your comments.

JamieA
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.
September 29, 2011

You should be able to read the system property catalina.base and append the rest. Difficult to see why you need this in code though...?

JamieA
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.
September 29, 2011

ie: System.getProperty("catalina.base")

I'm assuming tomcat, for other app servers it will be something different, but same principal.

Jobin Kuruvilla [Adaptavist]
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.
September 29, 2011

or try ActionContext.getContext().getRequestImpl().getContextPath() ?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events