Skip to content

Resize QTI images at publish to their authored size - #6219

Open
rtibblesbot wants to merge 2 commits into
learningequality:unstablefrom
rtibblesbot:issue-6189-ddc7c9
Open

rtibblesbot wants to merge 2 commits into
learningequality:unstablefrom
rtibblesbot:issue-6189-ddc7c9

Conversation

@rtibblesbot

@rtibblesbot rtibblesbot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Each sized <img> ships a resized copy per size in the QTI package and the derived Perseus archive.
  • QTI XML keeps width/height; Perseus markdown gets =WxH and a filled images map.
  • Shared resize path keeps GIF animation, EXIF orientation and JPEG colour profiles, and ships the original when a resize fails.

References

Refs #6189. Refs #6213. Refs #6215 (overlaps #6216). Kolibri display: learningequality/kolibri#15383.

Reviewer guidance

Legacy publish output changes:

  • Sized SVGs ship a copy per size with root width/height (and a viewBox when missing).
  • Animated images at natural size or over MAX_ANIMATED_IMAGE_PIXELS ship the original.
  • Same-size re-encodes ship only when smaller than the original.
  • Legacy <img> in the QTI package now carries width/height.

Open risk:

  • Only unprefixed <img> tags are rewritten; a foreign package using a namespace prefix ships full-size files.

Deviations from the issue spec

Criterion Why not
Resized image shows at its authored size in Kolibri's QTI viewer Package tested; Kolibri display not checked end to end.
Derived Perseus archive shows at that size in older Kolibri Archive tested; older Kolibri display not checked.
Same image at two sizes shows at each size in both formats Both archives tested; Kolibri display not checked.
Sized images keep aspect ratio on narrow screens Kolibri-side rendering; not checked in Kolibri.

AI usage

Used Claude Code to plan and implement the publish-time resize and its tests. Verified with the tests/utils/ suite and pre-commit.

🤖 Generated with Claude Code


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Ran pre-flight CI checks (lint, format, tests) and verified all pass
  • Rebased onto the target branch and resolved any conflicts
  • Reorganized commit history into clean, logical commits
  • Audited the diff to ensure only issue-relevant files are changed
  • Built PR body from the repository's PR template with evidence blocks
@rtibblesbot

🟡 Waiting for feedback

Last updated: 2026-10-02 04:59 UTC

@rtibblesbot

Copy link
Copy Markdown
Contributor Author

Outside this PR's scope — tracked under #5998:


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Ran pre-flight CI checks (lint, format, tests) and verified all pass
  • Rebased onto the target branch and resolved any conflicts
  • Reorganized commit history into clean, logical commits
  • Audited the diff to ensure only issue-relevant files are changed
  • Built PR body from the repository's PR template with evidence blocks

@rtibbles rtibbles self-assigned this Sep 30, 2026
@rtibblesbot
rtibblesbot marked this pull request as ready for review September 30, 2026 22:53
@rtibblesbot
rtibblesbot requested review from a team and marcellamaki September 30, 2026 22:54
@rtibblesbot
rtibblesbot force-pushed the issue-6189-ddc7c9 branch 2 times, most recently from d7d0b26 to 138c5e3 Compare October 1, 2026 21:43
rtibblesbot and others added 2 commits October 1, 2026 21:55
- Animated GIFs resize every frame, keeping timing and loop; at natural size the original ships.
- Past MAX_RESIZED_IMAGE_PIXELS the original ships.
- EXIF-rotated photos come out upright; JPEGs keep their ICC profile.
- Same-size re-encodes ship only when smaller than the original.
- Sized SVGs get root width/height (and a viewBox when missing).
- A failed resize ships the original instead of a dangling reference.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Sized <img> (integer width and height) ship a resized copy per size in the QTI package; width/height stay in the XML.
- Rewrites go per element, so one image at two sizes ships two files.
- Derived Perseus markdown carries ` =WxH`, so publish resizes and fills the images map.
- Legacy items keep the size on their QTI <img>.

Refs learningequality#6189

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants