# 0055. Editor images are pictures, drawn as versions at render time

- **Status:** Accepted
- **Date:** 2026-09-25

## Context

The admin editor could not insert an image. The images the Drupal bodies carry point at files that no longer
exist. An uploaded image is as large as it was taken, and a text column draws it at most 966 CSS pixels wide.

## Decision

An editor upload creates a `Picture` and the editor inserts the **original's** URL. `Wysiwyg::render()`
recognises an original by its path (`/contents/<Y>/<m>/<d>/<slug>-<id>-<His>.<ext>`), checks that it is still
that picture's URL, and draws it with `Picture::tag()` as `wys` (JPEG originals, with a WebP twin) or `wyp`
(everything else, format and transparency kept), with `sizes` for the text column.

The upload uses CKEditor 4's own image dialog, `filebrowser` and `uploadimage` plugins, which the local build
already carries. No plugin of our own.

## Alternatives

- **Insert the version's URL.** Rejected: the stored HTML would fix one size and format. Changing either would
  mean rewriting every body.
- **A `data-picture-id` attribute.** Rejected: the path already carries the id, and the URL check is needed
  anyway, so that a deleted picture's id is not drawn as whichever picture holds it later.
- **A one-click plugin of our own.** Not needed yet. The dialog's upload tab takes one more click, "Küldés a
  szerverre".

## Consequences

- The stored HTML stays plain `<img>` that works without the render step, in the editor too.
- An original no wider than the version (1000) is left as it is and only gets its size written in, as before.
- The 2x version of an original narrower than 2000 is enlarged.
- The upload endpoint checks admin login only, no model right: any editor on any screen uses it.
