Ticket #15668: 15668.diff
File 15668.diff, 5.8 KB (added by , 14 years ago) |
---|
-
wp-admin/css/media.dev.css
diff --git wp-admin/css/media.dev.css wp-admin/css/media.dev.css index 66cd7e1..ad54b20 100644
tr.image-size div.image-size-item { 79 79 float: left; 80 80 width: 25%; 81 81 margin: 0; 82 margin-bottom:6px; 82 83 } 83 84 84 85 #library-form .progress, -
wp-admin/includes/media.php
diff --git wp-admin/includes/media.php wp-admin/includes/media.php index c688b5e..dff8872 100644
function image_align_input_fields( $post, $checked = '' ) { 845 845 * @return unknown 846 846 */ 847 847 function image_size_input_fields( $post, $check = '' ) { 848 global $_wp_additional_image_sizes; 849 850 // get a list of the actual pixel dimensions of each possible intermediate version of this image 851 $size_names = array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size')); 848 852 849 // get a list of the actual pixel dimensions of each possible intermediate version of this image 850 $size_names = array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size')); 851 852 if ( empty($check) ) 853 $check = get_user_setting('imgsize', 'medium'); 854 855 foreach ( $size_names as $size => $label ) { 856 $downsize = image_downsize($post->ID, $size); 857 $checked = ''; 858 859 // is this size selectable? 860 $enabled = ( $downsize[3] || 'full' == $size ); 861 $css_id = "image-size-{$size}-{$post->ID}"; 862 // if this size is the default but that's not available, don't select it 863 if ( $size == $check ) { 864 if ( $enabled ) 865 $checked = " checked='checked'"; 866 else 867 $check = ''; 868 } elseif ( !$check && $enabled && 'thumbnail' != $size ) { 869 // if $check is not enabled, default to the first available size that's bigger than a thumbnail 870 $check = $size; 871 $checked = " checked='checked'"; 872 } 853 foreach( $_wp_additional_image_sizes as $size_name => $size_name_attr ){ 854 $size_names[$size_name] = __($size_name_attr['label']); 855 } 856 857 $size_names = apply_filters( 'image_size_names', $size_names ); 858 859 if ( empty($check) ) 860 $check = get_user_setting('imgsize', 'medium'); 873 861 874 $html = "<div class='image-size-item'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />"; 862 foreach ( $size_names as $size => $label ) { 863 $downsize = image_downsize($post->ID, $size); 864 $checked = ''; 875 865 876 $html .= "<label for='{$css_id}'>$label</label>"; 877 // only show the dimensions if that choice is available 866 // is this size selectable? 867 $enabled = ( $downsize[3] || 'full' == $size ); 868 $css_id = "image-size-{$size}-{$post->ID}"; 869 // if this size is the default but that's not available, don't select it 870 if ( $size == $check ) { 878 871 if ( $enabled ) 879 $html .= " <label for='{$css_id}' class='help'>" . sprintf( "(%d × %d)", $downsize[1], $downsize[2] ). "</label>"; 872 $checked = " checked='checked'"; 873 else 874 $check = ''; 875 } elseif ( !$check && $enabled && 'thumbnail' != $size ) { 876 // if $check is not enabled, default to the first available size that's bigger than a thumbnail 877 $check = $size; 878 $checked = " checked='checked'"; 879 } 880 880 881 $html .= '</div>';881 $html = "<div class='image-size-item'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />"; 882 882 883 $out[] = $html; 884 } 883 $html .= "<label for='{$css_id}'>$label</label>"; 884 // only show the dimensions if that choice is available 885 if ( $enabled ) 886 $html .= " <label for='{$css_id}' class='help'>" . sprintf( "(%d × %d)", $downsize[1], $downsize[2] ). "</label>"; 885 887 886 return array( 887 'label' => __('Size'), 888 'input' => 'html', 889 'html' => join("\n", $out), 890 ); 888 $html .= '</div>'; 889 890 $out[] = $html; 891 } 892 893 return array( 894 'label' => __('Size'), 895 'input' => 'html', 896 'html' => join("\n", $out), 897 ); 891 898 } 892 899 893 900 /** -
wp-content/themes/twentyten/functions.php
diff --git wp-content/themes/twentyten/functions.php wp-content/themes/twentyten/functions.php index 3f236c9..7bf6f2a 100644
function twentyten_setup() { 119 119 // We'll be using post thumbnails for custom header images on posts and pages. 120 120 // We want them to be 940 pixels wide by 198 pixels tall. 121 121 // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. 122 set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );122 set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true, __( 'Post Thumbnail' ) ); 123 123 124 124 // Don't support text inside the header image. 125 125 if ( ! defined( 'NO_HEADER_TEXT' ) ) -
wp-includes/media.php
diff --git wp-includes/media.php wp-includes/media.php index 041c4e5..8f7ba23 100644
function image_downsize($id, $size = 'medium') { 178 178 /** 179 179 * Registers a new image size 180 180 */ 181 function add_image_size( $name, $width = 0, $height = 0, $crop = false ) {181 function add_image_size( $name, $width = 0, $height = 0, $crop = false, $label = false ) { 182 182 global $_wp_additional_image_sizes; 183 $_wp_additional_image_sizes[$name] = array( 'width' => absint( $width ), 'height' => absint( $height ), 'crop' => (bool) $crop ); 183 if ( ! $label ) 184 $label = $name; 185 $_wp_additional_image_sizes[$name] = array( 'width' => absint( $width ), 'height' => absint( $height ), 'crop' => (bool) $crop, 'label' => $label ); 184 186 } 185 187 186 188 /** 187 189 * Registers an image size for the post thumbnail 188 190 */ 189 function set_post_thumbnail_size( $width = 0, $height = 0, $crop = false ) {190 add_image_size( 'post-thumbnail', $width, $height, $crop );191 function set_post_thumbnail_size( $width = 0, $height = 0, $crop = false, $label = false ) { 192 add_image_size( 'post-thumbnail', $width, $height, $crop, $label ); 191 193 } 192 194 193 195 /**