Make WordPress Core

Changeset 34258


Ignore:
Timestamp:
09/17/2015 05:02:52 AM (9 years ago)
Author:
wonderboymusic
Message:

Media: In wp_prepare_attachment_for_js(), don't call file_exists() and filesize() to retrieve $bytes if the data is already present in $meta. This is how the same code in attachment_submitbox_metadata() already works.

Props polevaultweb.
Fixes #33214.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r34163 r34258  
    27792779
    27802780    $attached_file = get_attached_file( $attachment->ID );
    2781     if ( file_exists( $attached_file ) ) {
     2781   
     2782    if ( isset( $meta['filesize'] ) ) {
     2783        $bytes = $meta['filesize'];
     2784    } elseif ( file_exists( $attached_file ) ) {
    27822785        $bytes = filesize( $attached_file );
     2786    } else {
     2787        $bytes = '';
     2788    }
     2789
     2790    if ( $bytes ) {
    27832791        $response['filesizeInBytes'] = $bytes;
    27842792        $response['filesizeHumanReadable'] = size_format( $bytes );
Note: See TracChangeset for help on using the changeset viewer.