Skip to content

[QTI] A sized image with a srcset should publish its srcset at the authored size #6278

Open

Description

@rtibblesbot

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

Once #6189 lands, publish resizes each <img> with a pixel width/height and points its src at the resized copy. It leaves srcset alone, so its candidates still point at the full-size original, and a browser that picks from srcset ignores the resized src. The QTI editor doesn't write srcset, but the QTI img model accepts it, so items imported through the internal API can carry it.

Complexity: Low
Target branch: unstable

Context

rewrite_qti_sized_image_paths in contentcuration/contentcuration/utils/assessment/qti/media.py rewrites src only. This item:

<img src="<md5>.png" srcset="<md5>.png 1x, <md5>.png 2x" width="100" height="50"/>

publishes in the QTI package as:

<img src="images/<md5>_100x50.png" srcset="images/<md5>.png 1x, images/<md5>.png 2x" width="100" height="50"/>

The original ships alongside the resized copy.

The Change

A sized <img> with a srcset should display at its authored size in the QTI package, whichever candidate the browser picks. Whether each candidate is resized to its density or the srcset is replaced is the implementer's call.

Acceptance Criteria

  • A sized <img> whose srcset references Studio media publishes with no candidate pointing at the full-size original.
  • An <img> with a srcset but no pixel size publishes unchanged.
  • Publish tests cover each case.

AI usage

rtibbles asked for this follow-up in a review of #6219. Claude Code reproduced the output above against the #6219 branch and drafted this issue.

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions