Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a file size field to the REST API and use its value when fetching media #7

Open
johnbillion opened this issue Mar 16, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@johnbillion
Copy link
Member

This is a follow-up to #6.

The file size is not exposed by default in the WordPress REST API media endpoint. This plugin should add a new field to the REST API which exposes it, and then reads that value in Factory::create() and sets the file size via $item->set_file_size() if the field exists.

This would solve the problem of not having file size information when this plugin is used for sharing media within a Multisite network.

Longer term, we should open a ticket for WordPress core to get the file size added to the REST API too.

@tfrommen
Copy link
Contributor

Just noting that, for audio files, this information is already present in $data->media_details->filesize. For any other media type, it is not.

@tfrommen
Copy link
Contributor

Also, I just created https://core.trac.wordpress.org/ticket/52840.

@roborourke
Copy link
Contributor

Older issue I know but any change to enable this would have to be in code running on the source site, this plugin won't necessarily be enabled there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants