Inconsistent image sizes in Fabric renderer and view/export_view formats

When a user uses images inside of page layout (and likely also inside of other container elements like tables) then Confluence uses different sizes for the images, depending on how the page is rendered (browser vs view format through the API).

Steps to reproduce:

  1. Create a new Confluence page
  2. attach an image called “test-image.png” to the page
  3. Update the page content with the following storage format (through the REST API or one of the storage format editors like ours):
<ac:layout>
    <ac:layout-section ac:type="fixed-width" ac:breakout-mode="default">
        <ac:layout-cell>
            <ac:image ac:align="center" ac:layout="center" ac:original-height="144" ac:original-width="144" ac:width="50">
                <ri:attachment ri:filename="test-image.png" ri:version-at-save="2"/>
            </ac:image>
        </ac:layout-cell>
    </ac:layout-section>
    <ac:layout-section ac:type="two_left_sidebar" ac:breakout-mode="full-width">
        <ac:layout-cell>
            <ac:image ac:align="center" ac:layout="center" ac:original-height="144" ac:original-width="144" ac:width="50">
                <ri:attachment ri:filename="test-image.png" ri:version-at-save="2"/>
            </ac:image>
        </ac:layout-cell>
        <ac:layout-cell>
            <ac:image ac:align="center" ac:layout="center" ac:original-height="144" ac:original-width="144" ac:width="50">
                <ri:attachment ri:filename="test-image.png" ri:version-at-save="2"/>
            </ac:image>
        </ac:layout-cell>
    </ac:layout-section>
</ac:layout>

Expected result:
All the images in the page use the same size (ideally 50px)

Actual result:
Depending on how the page is rendered the images come out in different sizes:

  • In Confluence when the page has been created with the current Fabric editor:

    • all the images are different sizes. The image dimensions don’t respect the 50px size at all anymore but are calculated as a percentage of the width of the surrounding page layout cell. The sizes can range from much larger than 50px to as tiny as 10px or so.
  • When page is rendered to the view/export_view formats through the API or if the page is still using the legacy editor:


This inconsistency of REST API and Confluence browser view is again making it look like our exporter apps are not rendering correctly, when actually Confluence is providing inconsistent view formats between API and the browser view once again.
This also affects the built-in Confluence PDF export, not just third-party apps. Either the view and export_view formats need to be adapted to also use different image sizes based on the image container or the new page renderer needs to render all images the same size in this case.

1 Like