Home/Confluence storage format reference
Confluence storage format
Image attributes: ac:width, ac:align, ac:alt and more
The storage format page lists ac:align, ac:border, ac:class, ac:title, ac:style, ac:thumbnail, ac:alt, ac:height, ac:width, ac:vspace and ac:hspace. Most are stored and rendered, but ac:style is emptied on save, and only width, alignment, alt text, a border and a caption survive an ADF save.
Storage format
<ac:image ac:width="200"><ri:url ri:value="https://example.com/logo.png" /></ac:image>
<ac:image ac:align="center" ac:layout="center" ac:width="300"><ri:url ri:value="https://example.com/logo.png" /></ac:image>
<ac:image ac:alt="Company logo" ac:border="true"><ri:url ri:value="https://example.com/logo.png" /></ac:image>
As ADF (Confluence Cloud)
The ADF that Confluence Cloud builds for:
<p><ac:image ac:border="true" ac:title="Logo tooltip" ac:alt="Company logo" ac:height="100" ac:vspace="10" ac:hspace="10" ac:class="my-class" ac:style="opacity: 0.5"><ri:url ri:value="https://example.com/logo.png" /></ac:image></p>
{
"type": "doc",
"content": [
{
"type": "mediaSingle",
"attrs": {
"layout": "align-start"
},
"content": [
{
"type": "media",
"attrs": {
"alt": "Company logo",
"type": "external",
"url": "https://example.com/logo.png"
},
"marks": [
{
"type": "border",
"attrs": {
"size": 1,
"color": "#758195"
}
}
]
},
{
"type": "caption",
"content": [
{
"text": "Logo tooltip",
"type": "text"
}
]
}
]
}
],
"version": 1
}
Examples
Storage format sent
<p><ac:image ac:width="200"><ri:url ri:value="https://example.com/logo.png" /></ac:image></p>Limiting an image to a fixed width.
Rendered view (HTML)
<p><span class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img class="confluence-embedded-image confluence-external-resource" width="200" src="https://example.com/logo.png" data-image-src="https://example.com/logo.png" loading="lazy"></span></p>Storage format after the round trip through ADF
<ac:image ac:align="left" ac:layout="align-start" ac:custom-width="true" ac:width="200" ac:src="https://example.com/logo.png"><ri:url ri:value="https://example.com/logo.png" /></ac:image>Sent to Confluence Cloud on .
Storage format sent
<p><ac:image ac:align="center" ac:layout="center" ac:width="300"><ri:url ri:value="https://example.com/logo.png" /></ac:image></p>Centering an image, which needs both ac:align and ac:layout in current content.
Rendered view (HTML)
<p><span class="confluence-embedded-file-wrapper image-center-wrapper confluence-embedded-manual-size"><img class="confluence-embedded-image confluence-external-resource image-center" width="300" src="https://example.com/logo.png" data-image-src="https://example.com/logo.png" loading="lazy"></span></p>Storage format after the round trip through ADF
<ac:image ac:align="center" ac:layout="center" ac:custom-width="true" ac:width="300" ac:src="https://example.com/logo.png"><ri:url ri:value="https://example.com/logo.png" /></ac:image>Sent to Confluence Cloud on .
Storage format sent
<p><ac:image ac:border="true" ac:title="Logo tooltip" ac:alt="Company logo" ac:height="100" ac:vspace="10" ac:hspace="10" ac:class="my-class" ac:style="opacity: 0.5"><ri:url ri:value="https://example.com/logo.png" /></ac:image></p>Setting every attribute from the documentation list in one image, to see which are kept.
Rendered view (HTML)
<p><span class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img class="confluence-embedded-image my-class confluence-external-resource confluence-content-image-border" alt="Company logo" height="100" hspace="10" vspace="10" src="https://example.com/logo.png" data-image-src="https://example.com/logo.png" loading="lazy"></span></p>Storage format after the round trip through ADF
<ac:image ac:align="left" ac:layout="align-start" ac:alt="Company logo" ac:src="https://example.com/logo.png"><ri:url ri:value="https://example.com/logo.png" /><ac:caption><p>Logo tooltip</p></ac:caption><ac:adf-mark key="border" size="1" color="#758195" /></ac:image>Sent to Confluence Cloud on .
Storage format sent
<p><ac:image ac:thumbnail="true"><ri:url ri:value="https://example.com/logo.png" /></ac:image></p>Marking an image as a thumbnail.
Rendered view (HTML)
<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image confluence-thumbnail confluence-external-resource" src="https://example.com/logo.png" data-image-src="https://example.com/logo.png" loading="lazy"></span></p>Storage format after the round trip through ADF
<ac:image ac:align="left" ac:layout="align-start" ac:src="https://example.com/logo.png"><ri:url ri:value="https://example.com/logo.png" /></ac:image>Sent to Confluence Cloud on .
What changes in conversion
- ac:width is kept and rendered as the width of the image. It returns with ac:custom-width set to true after an ADF save.
- ac:align and ac:layout are kept together. An image without them returns as left aligned.
- ac:alt is kept as the ADF alt text. ac:border becomes an ADF border mark with a size of 1 and a grey color, and returns as ac:adf-mark.
- ac:title is not kept as a title. An ADF save moves its text into a caption element under the image.
- ac:height, ac:vspace, ac:hspace, ac:class, ac:style and ac:thumbnail are not kept by an ADF save. In storage, ac:style is emptied to an empty value on the first save, and the style never reaches the view.
Pitfalls
- The documentation describes ac:style as a css style, but a value sent in the probe was stored as empty and was not rendered. Do not use it for sizing or effects.
- In the view, ac:title is not rendered as a tooltip on the image. The text is kept in storage only until an editor save turns it into a caption.
- ac:thumbnail adds a thumbnail class in the view but is lost on the next editor save, so it is not a lasting setting.
- Set a width and alignment in storage if you want them to survive, because those are the attributes the ADF form can hold.
Related
- <ac:image> from a URL
- Attached images
- Alignment and indentation
- Storage format vs ADF
- HTML that storage format drops