Changeset 5801
- Timestamp:
- 07/15/2007 05:52:50 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/upload.php
r5676 r5801 6 6 $attachment_data = wp_get_attachment_metadata( $id ); 7 7 $is_image = (int) wp_attachment_is_image(); 8 $filesystem_path = get_attached_file( $id ); 8 9 if ( !isset($attachment_data['width']) && $is_image ) { 9 if ( $image_data = getimagesize( get_attached_file( $id )) ) {10 if ( $image_data = getimagesize( $filesystem_path ) ) { 10 11 $attachment_data['width'] = $image_data[0]; 11 12 $attachment_data['height'] = $image_data[1]; … … 39 40 if ( $href ) 40 41 $r .= "</a>\n"; 42 $r .= "\t\t\t\t<span class='upload-file-size'>".size_format(filesize($filesystem_path))."</span>\n"; 41 43 $r .= "\n\t\t<div class='upload-file-data'>\n\t\t\t<p>\n"; 42 44 $r .= "\t\t\t\t<input type='hidden' name='attachment-url-$id' id='attachment-url-$id' value='$src' />\n"; -
trunk/wp-includes/functions.php
r5796 r5801 90 90 91 91 return number_format($number, $decimals, $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']); 92 } 93 94 function size_format($bytes, $decimals = null) { 95 // technically the correct unit names for powers of 1024 are KiB, MiB etc 96 // see http://en.wikipedia.org/wiki/Byte 97 $quant = array( 98 'TB' => pow(1024, 4), 99 'GB' => pow(1024, 3), 100 'MB' => pow(1024, 2), 101 'kB' => pow(1024, 1), 102 'B' => pow(1024, 0), 103 ); 104 105 foreach ($quant as $unit => $mag) 106 if ( intval($bytes) >= $mag ) 107 return number_format_i18n($bytes / $mag, $decimals) . ' ' . $unit; 92 108 } 93 109
Note: See TracChangeset
for help on using the changeset viewer.