#44405 closed feature request (fixed)
Updating/Cropping Images via Rest API
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.5 | Priority: | normal |
Severity: | normal | Version: | 4.9.6 |
Component: | REST API | Keywords: | has-patch has-unit-tests has-dev-note |
Focuses: | Cc: |
Description
At the current moment it is not possible to update an attachment via the rest API, so if using the WordPress Crop Image functionality, there is no way to update the existing media.
I discussed this at WCEU in Belgrade with Mike Schroder. This was obviously simply forgotten.
Change History (17)
This ticket was mentioned in Slack in #core-media by apermo. View the logs.
7 years ago
This ticket was mentioned in Slack in #core-restapi by apermo. View the logs.
7 years ago
This ticket was mentioned in Slack in #core-editor by joemcgill. View the logs.
5 years ago
This ticket was mentioned in Slack in #core-restapi by joemcgill. View the logs.
5 years ago
This ticket was mentioned in Slack in #core-restapi by timothybjacobs. View the logs.
5 years ago
This ticket was mentioned in Slack in #core-restapi by timothybjacobs. View the logs.
5 years ago
This ticket was mentioned in Slack in #core-restapi by azaozz. View the logs.
5 years ago
#9
@
5 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to 5.5
https://github.com/WordPress/gutenberg/blob/master/lib/class-wp-rest-image-editor-controller.php is ready for adding to trunk. Works with the current image editor in the block editor (the JS for it is already in).
This ticket was mentioned in PR #388 on WordPress/wordpress-develop by TimothyBJacobs.
5 years ago
#10
- Keywords has-patch has-unit-tests added; needs-patch removed
Porting the edit image endpoint from [Gutenberg](https://github.com/WordPress/gutenberg/blob/21709e3c533e78f9e63c583b6109caadc7cdf7be/lib/class-wp-rest-image-editor-controller.php).
This is a WIP, working on adding tests. One question I had was the descriptions of the request args, I did my best to add them based on my understanding of how the endpoint works, but that might not be accurate.
Cc: @ajlende.
Trac ticket: https://core.trac.wordpress.org/ticket/44405
5 years ago
#11
Looks good, just one small nitpick :)
Will also need to verify that $image_meta
is actually for the same image as it is retrieved by using the attachment ID that is hard-coded in post_content. (Can patch that in trunk. There is another patch that needs the same and will have to make a new function.)
TimothyBJacobs commented on PR #388:
5 years ago
#12
Should we be checking against upload_is_user_over_quota
@azaozz?
5 years ago
#13
Should we be checking against upload_is_user_over_quota
Possibly, but seems better to let the user edit the image, and decide if they should delete the parent image? Users can get over the quota even when uploading a large image that creates many sub-sizes...
TimothyBJacobs commented on PR #388:
5 years ago
#14
Possibly, but seems better to let the user edit the image, and decide if they should delete the parent image? Users can get over the quota even when uploading a large image that creates many sub-sizes...
Gotcha. I'll leave it alone for now then.
This works for me testing against the latest Gutenberg. It still doesn't work alone on trunk since the JS in trunk is still expecting the old endpoint.
#15
@
5 years ago
- Owner set to TimothyBlynJacobs
- Resolution set to fixed
- Status changed from new to closed
In 48291:
I'd like to see these actions be supported by the REST API. The functionality can mirror
wp_ajax_image_editor()
, generally and would allow us to build new interfaces on top of the REST API rather than AJAX callbacks, and extend that ability to other clients.