Opened 10 years ago
Closed 8 weeks ago
#33768 closed enhancement (maybelater)
Include image_meta in wp_prepare_attachment_for_js response for images
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.4 |
Component: | Media | Keywords: | needs-unit-tests has-patch |
Focuses: | Cc: |
Description
Currently seems odd that the image_meta array isn't returned in the response from wp_prepare_attachment_for_js for an image.
The function already calls get_attachment_metadata so the image_meta array is readily available.
The meta key is already declared in the response array.
All other mime types populate the meta value in the response array in a similar fashion as my proposal.
I can't see any downside or overhead, and the function becomes much more powerful, particulaly for gallery implenmenations, as a result.
The addition is just three lines (in wp-includes/media.php #L2835 of current version).
Attachments (2)
Change History (8)
#2
@
10 years ago
- Keywords needs-patch needs-unit-tests added
As I also mentioned on #33772, a real patch showing your changes would be nice.
Also, a unit test exists for the wp_prepare_attachment_for_js
function which would need to be extended to reflect this change. You can read this section about automated testing to see what that means. Don't worry if it doesn't work or something, I'm sure someone else could help out too.
#3
@
10 years ago
Ok, added :) First Ticket, first patch, first time using SVN so apologies if anything's incorrect.
Not overly familiar with unit tests either but . I'm sure I'll get there too with a bit of investigating. Thanks for the pointers
#5
@
10 years ago
- Keywords close added
The other types need the metadata to render in the admin/media modal properly. Images do not. $meta
is available as a param to the 'wp_prepare_attachment_for_js'
filter. I would suggest adding it to the response there.
#6
@
8 weeks ago
- Keywords close removed
- Resolution set to maybelater
- Status changed from new to closed
I'm going to close this one out as maybelater
.
It's been 10 years since there has been any activity on this ticket, so it's not in high demand. The current Core implementation still does not require this data. There is a filter available to add the additional data, if desired.
Discussion can always continue on closed tickets, and they can be reopened in the future if conditions change.
Should note the addition is at line 145 of the attached (uploaded only the wp_prepare_attachment_for_js function rather than entire media.php file).