﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	focuses
66027	REST API: let the media create endpoint record the attachment an upload was edited from	adamsilverstein		"''Claude Code drafted this ticket from the Gutenberg change, forwarded along:''

> With client-side media processing, Gutenberg is moving image edits (crop, rotate, flip) from the server `media/<id>/edit` endpoint into the browser: the edit is applied with libvips and the result is uploaded through `POST /wp/v2/media` as a new attachment, the same way the editor has always created edited images. See https://github.com/WordPress/gutenberg/pull/82362 (fixes https://github.com/WordPress/gutenberg/issues/82295, where server-side edits strip the gain map from HDR JPEGs).
>
> One thing the `/edit` endpoint does that the upload endpoint cannot is record where the new image came from: it stores a `parent_image` entry (`attachment_id` and the source's relative `file` path) in the new attachment's metadata, copies the source's EXIF `image_meta` for any field the new file lacks, and resets the orientation to 1. Edits made in the browser should relate to their source the same way.
>
> Proposed change: add an optional `parent_image` integer parameter to the media create endpoint. When set, it must reference an existing image attachment the current user can edit (matching the `/edit` permission check), and after the upload the new attachment's metadata gets the same `parent_image` entry and EXIF carry-over that `edit_media_item()` writes. Without the parameter nothing changes.
>
> Related: #65367 (client-side media processing endpoints).

Patch incoming."	enhancement	new	normal	7.2	REST API	trunk	normal		has-patch has-unit-tests		rest-api
