Repository navigation
REST API: Return the file size of the original image for a scaled attachment - #16370
jorgefilipecosta wants to merge 1 commit into
Conversation
…achment. For an image that was scaled down on upload, the attachments controller returned the original file name in `filename` but the stored size of the `-scaled` copy in `filesize`. The stored size is now used only when the original file is the attached file; otherwise the size of the original file is returned. Fixes #66892.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Makes the media endpoint's
filesizedescribe the same file asfilenamefor a scaled image.For an image that WordPress scaled down on upload,
filenamenames the original file, butfilesizereturned the size stored in the attachment metadata, which belongs to the-scaledcopy. The stored size is now used only when the original file is the attached file; otherwise the size of the original file is returned.Trac ticket: https://core.trac.wordpress.org/ticket/66892
Testing
Verify unit tests are passing:
Drafted with AI assistance (Claude Code) and reviewed by me.