[wp-trac] [WordPress Trac] #49412: Store filesize media metadata

WordPress Trac noreply at wordpress.org
Thu Mar 10 13:08:34 UTC 2022

#49412: Store filesize media metadata
 Reporter:  Cybr                             |       Owner:  spacedmonkey
     Type:  feature request                  |      Status:  closed
 Priority:  normal                           |   Milestone:  6.0
Component:  Media                            |     Version:
 Severity:  normal                           |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit  |     Focuses:  performance
Changes (by spacedmonkey):

 * status:  assigned => closed
 * resolution:   => fixed


 In [changeset:"52837" 52837]:
 #!CommitTicketReference repository="" revision="52837"
 Media: Store attachment’s file size in metadata.

 Store the file size of all newly uploaded attachments, as part of the
 metadata stored in post meta. Storing file size means, developers will not
 have to resort to doing `filesize` function calls, that can be time
 consuming on assets on offloaded to services like Amazon’s S3.

 This change also introduces a new helper function called, `wp_filesize`.
 This is a wrapper around the `filesize` php function, that adds some
 helpful filters and ensures the return value is an integer.

 Props Cybr, Spacedmonkey, SergeyBiryukov, johnwatkins0, swissspidy,
 desrosj, joemcgill, azaozz, antpb, adamsilverstein, uday17035.
 Fixes #49412.

Ticket URL: <https://core.trac.wordpress.org/ticket/49412#comment:50>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list