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

Idea: store filesize attachment meta value on upload. #492

Closed
goldenapples opened this issue Feb 17, 2021 · 0 comments · Fixed by #493
Closed

Idea: store filesize attachment meta value on upload. #492

goldenapples opened this issue Feb 17, 2021 · 0 comments · Fixed by #493

Comments

@goldenapples
Copy link
Contributor

There are a few places in core, like wp_prepare_attachment_for_js, that do a filesystem stat check for attachments to get the filesize in bytes:

https://github.com/WordPress/WordPress/blob/master/wp-includes/media.php#L3969-L3975

This can be short-circuited if the "filesize" property is set in the attachment meta array.

Setting this property seems as though it would eliminate the need for several AWS S3 requests which happen as part of the query-attachments ajax action. Is it feasible to set it on uploading attachments?

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

Successfully merging a pull request may close this issue.

1 participant