Make WordPress Core

Opened 18 hours ago

Last modified 17 hours ago

#65987 new enhancement

Media Editor Modal: track the original attachment id for edited images

Reported by: ramonopoly Owned by:
Priority: normal Milestone: 7.2
Component: Media Version: trunk
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses:

Description

This ticket tracks the work for the following issue:

Media: Tracking the relationship between original images and their cropped derivatives

And PR:

Media: track the original attachment id for edited images- #81803

When Gutenberg crops an image, Core's /edit creates an entirely new attachment with no stable pointer back to the image the lineage started from.

parent_image records only the immediate source; there is no root/original reference across crop-of-crop chains.

That means we can't navigate a crop back to its original in a performant way, that is, without getting each post up the change where parent_image exists.

Media: track the original attachment id for edited images- #81803 proposes to add a dedicated postmeta key _wp_attachment_original_id stores the root id.

There's no conflict with the current "restore image" functionality in the media library, which is file-based.

Change History (2)

#1 @ramonopoly
18 hours ago

  • Component GeneralMedia

This ticket was mentioned in PR #13303 on WordPress/wordpress-develop by @ramonopoly.


17 hours ago
#2

  • Keywords has-patch has-unit-tests added

## What? Why?

When Gutenberg crops an image, Core's /edit creates an entirely new attachment with no stable pointer back to the image the lineage started from.

parent_image records only the immediate source; there is no root/original reference across crop-of-crop chains.

That means we can't navigate a crop back to its original in a performant way, that is, without getting each post up the change where parent_image exists.

This PR adds original_attachment metadata under media_details to track the lineage.

Trac ticket: https://core.trac.wordpress.org/ticket/65987

## Use of AI Tools

To create the backport of https://github.com/WordPress/gutenberg/pull/81803 and its tests

Note: See TracTickets for help on using tickets.