How to display attached images with markdown

apurva abhyankar August 7, 2017

I want to display an image(attached to the page) with markdown. From what I looked up on the various portals, the format is:

![Alt text](/path/to/img.jpg)

But, this works for actual links to the image. How do i reference the image that is attached to the page itself.

4 answers

1 accepted

1 vote
Answer accepted
Stephen Deutsch
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.
August 8, 2017

It doesn't seem like the Wiki Markup converter has any smart check to determine whether an image is attached to a page or not, so you'll probably have to use the following format:

![](/download/attachments/<page_id>/<filename>)
apurva abhyankar August 8, 2017

Thank you for the answer. It worked. Really appreciate your help.

Stephen Deutsch
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.
August 8, 2017

No problem :)

Stephen Deutsch
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.
August 8, 2017

For anybody else coming to this page, the format is actually

![](<contextpath>/download/attachments/<page_id>/<filename>)

so for Confluence Cloud users it would be

 ![](/wiki/download/attachments/<page_id>/<filename>)
Milan Panic April 25, 2024

Hi, have tried this and it does not work for me?

Has something changed in the meantime?

Any ideas?

Would highly appreciate help

 

Works pefrectly with external links but not for internal:

External images should be avoided use the following format in markdown
BEST TO BE AVOIDED unless publicly available resources

Example:

![](https://i.ibb.co/ncPSnTF/sample-tech-specs-image.jpg)

For internal attachments - use following format
DOES NOT WORK UNFORTUNATELY:

![](/wiki/download/attachments/4238410304/sample_tech_specs_image.jpeg)

 

0 votes
Milan Panic April 25, 2024

Seems that this answer is not valid anymore in 2024:

Any ideas of the reason - would highly appreciate help?

 

External images should be avoided use the following format in markdown
BEST TO BE AVOIDED unless publicly available resources

Example:

![](https://i.ibb.co/ncPSnTF/sample-tech-specs-image.jpg)

For internal attachments - use following format
DOES NOT WORK UNFORTUNATELY:

![](/wiki/download/attachments/4238410304/sample_tech_specs_image.jpeg)

 

Ramesh Maduranga October 17, 2024

@Milan Panic This isn't working for me either. How did you manage to attach internal attachments?

Milan Panic October 17, 2024

I wasn't I simply don't have this feature...

We workaround it by presenting images outside of markdown - but it's stupid...

Like Ramesh Maduranga likes this
Ramesh Maduranga October 17, 2024

@Stephen Deutsch Tagging you in case you have a better answer.

Stephen Deutsch
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.
October 17, 2024

Hi, thanks for the tag.

When I originally wrote this answer, it was referring to the built-in markdown importer (Insert -> Markup, choose Markdown).

However, I see that according to this answer: 

https://community.atlassian.com/t5/Confluence-questions/Year-2024-How-to-display-attached-image-to-the-page-in-MARKDOWN/qaq-p/2681641

that @Milan Panic is using a third-party app to display Markdown (not sure which one).

To clarify why this does not work, it would help to explain that third-party apps run inside a frame and have their own URL (for example, https://example.com/markdown instead of https://mysite.atlassian.net). Therefore, if the markdown app does not use any extra processing to insert the confluence site name into the URL, it will try to render

https://example.com/wiki/download/attachments/4238410304/sample_tech_specs_image.jpeg

instead of

https://mysite.atlassian.net/wiki/download/attachments/4238410304/sample_tech_specs_image.jpeg

To fix this, you could just include the whole URL (not actually public, as it is your own site):

![](https://mysite.atlassian.net/wiki/download/attachments/4238410304/sample_tech_specs_image.jpeg)

instead of

![](/wiki/download/attachments/4238410304/sample_tech_specs_image.jpeg)

The only other option I can think of would be to contact the vendor of the markdown app and ask them to use a smart filling in of the URL when the site name is missing.

Ramesh Maduranga October 23, 2024

@Stephen Deutsch Thanks for the workaround. I’ll try it and update the status here.

Milan Panic October 24, 2024

I remember to have tried something - but was getting 403 with full URL but @Ramesh Maduranga please update us on the latest - maybe it will work...

![](https://mysite.atlassian.net/wiki/download/attachments/4238410304/sample_tech_specs_image.jpeg)

 

Ramesh Maduranga October 25, 2024

@Milan Panic that suggestion did the trick for me.
@Stephen Deutsch Thank you for your suggestion. it worked perfectly! The images are now visible on the page.

0 votes
apurva abhyankar August 8, 2017

Yes, COnfluence server 5.8

Stephen Deutsch
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.
August 8, 2017

Are you inserting markdown in the "Insert Markup" menu or using a plugin to display it?

apurva abhyankar August 8, 2017

Insert Markup

0 votes
Stephen Deutsch
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.
August 7, 2017

Hi Apurva,

Could you please let us know which product you are using (Confluence?), which type you are using (Cloud, Server), and if Server, which version?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events