Changeset 8612
- Timestamp:
- 08/11/2008 03:54:26 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/css/media.css
r8304 r8612 84 84 } 85 85 86 tr.image-size td { 87 width: 460px; 88 } 89 tr.image-size div.image-size-item { 90 float: left; 91 width: 25%; 92 margin: 0; 93 } 86 94 tr.image-size label { 87 95 display: inline; 88 margin: 0 1em 0 0;96 margin: 0 0 0 1em; 89 97 } 90 98 .pinkynail { … … 203 211 } 204 212 205 #media-upload p.help {213 #media-upload p.help, #media-upload label.help { 206 214 font-style: italic; 207 215 font-weight: normal; -
trunk/wp-admin/includes/image.php
r8600 r8612 97 97 98 98 // make thumbnails and other intermediate sizes 99 $sizes = array('thumbnail', 'medium' );99 $sizes = array('thumbnail', 'medium', 'large'); 100 100 $sizes = apply_filters('intermediate_image_sizes', $sizes); 101 101 -
trunk/wp-admin/includes/media.php
r8605 r8612 521 521 } 522 522 523 function image_size_input_fields($post, $checked='') { 524 525 // get a list of the actual pixel dimensions of each possible intermediate version of this image 526 $sizes = array(); 527 $size_names = array('thumbnail' => 'Thumbnail', 'medium' => 'Medium', 'large' => 'Large', 'full' => 'Full size'); 528 529 foreach ( $size_names as $size => $name) { 530 $downsize = image_downsize($post->ID, $size); 531 532 // is this size selectable? 533 $enabled = ( $downsize[3] || 'full' == $size ); 534 $css_id = "image-size-{$size}-{$post->ID}"; 535 // if $checked was not specified, default to the first available size that's bigger than a thumbnail 536 if ( !$checked && $enabled && 'thumbnail' != $size ) 537 $checked = $size; 538 539 $html = "<div class='image-size-item'><input type='radio' ".( $enabled ? '' : "disabled='disabled'")."name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'".( $checked == $size ? " checked='checked'" : '') ." />"; 540 541 $html .= "<label for='{$css_id}'>" . __($name). "</label>"; 542 // only show the dimensions if that choice is available 543 if ( $enabled ) 544 $html .= " <label for='{$css_id}' class='help'>" . sprintf( __("(%d × %d)"), $downsize[1], $downsize[2] ). "</label>"; 545 546 $html .= '</div>'; 547 548 $out[] = $html; 549 } 550 551 return array( 552 'label' => __('Size'), 553 'input' => 'html', 554 'html' => join("\n", $out), 555 ); 556 } 557 523 558 function image_attachment_fields_to_edit($form_fields, $post) { 524 559 if ( substr($post->post_mime_type, 0, 5) == 'image' ) { … … 529 564 530 565 $form_fields['post_content']['label'] = __('Description'); 531 532 $thumb = wp_get_attachment_thumb_url($post->ID);533 566 534 567 $form_fields['align'] = array( … … 545 578 <label for='image-align-right-$post->ID' class='align image-align-right-label'>" . __('Right') . "</label>\n", 546 579 ); 547 $form_fields['image-size'] = array( 548 'label' => __('Size'), 549 'input' => 'html', 550 'html' => " 551 " . ( $thumb ? "<input type='radio' name='attachments[$post->ID][image-size]' id='image-size-thumb-$post->ID' value='thumbnail' /> 552 <label for='image-size-thumb-$post->ID'>" . __('Thumbnail') . "</label> 553 " : '' ) . "<input type='radio' name='attachments[$post->ID][image-size]' id='image-size-medium-$post->ID' value='medium' checked='checked' /> 554 <label for='image-size-medium-$post->ID'>" . __('Medium') . "</label> 555 <input type='radio' name='attachments[$post->ID][image-size]' id='image-size-full-$post->ID' value='full' /> 556 <label for='image-size-full-$post->ID'>" . __('Full size') . "</label>", 557 ); 580 $form_fields['image-size'] = image_size_input_fields($post); 558 581 } 559 582 return $form_fields; -
trunk/wp-admin/includes/schema.php
r8600 r8612 259 259 add_option('enable_xmlrpc', 0); 260 260 261 // 2.7 262 add_option('large_size_w', 1024); 263 add_option('large_size_h', 1024); 264 261 265 // Delete unused options 262 266 $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins'); -
trunk/wp-admin/options-misc.php
r7883 r8612 63 63 </fieldset></td> 64 64 </tr> 65 <tr valign="top"> 66 <th scope="row"><?php _e('Large size') ?></th> 67 <td><fieldset><legend class="hidden"><?php _e('Large size') ?></legend> 68 <label for="large_size_w"><?php _e('Max Width'); ?></label> 69 <input name="large_size_w" type="text" id="large_size_w" value="<?php form_option('large_size_w'); ?>" size="6" /> 70 <label for="large_size_h"><?php _e('Max Height'); ?></label> 71 <input name="large_size_h" type="text" id="large_size_h" value="<?php form_option('large_size_h'); ?>" size="6" /> 72 </fieldset></td> 73 </tr> 65 74 </table> 66 75 -
trunk/wp-includes/media.php
r8600 r8612 5 5 // scale down the default size of an image so it's a better fit for the editor and theme 6 6 function image_constrain_size_for_editor($width, $height, $size = 'medium') { 7 global $content_width; 7 8 8 9 if ( is_array($size) ) { … … 24 25 // if no width is set, default to the theme content width if available 25 26 } 26 else { // $size == 'full'27 // we're inserting a fullsize image into the editor. if it's a really big image we'll scale it down to fit reasonably27 elseif ( $size == 'large' ) { 28 // we're inserting a large size image into the editor. if it's a really big image we'll scale it down to fit reasonably 28 29 // within the editor itself, and within the theme's content width if it's known. the user can resize it in the editor 29 30 // if they wish. 30 if ( !empty($GLOBALS['content_width']) ) { 31 $max_width = $GLOBALS['content_width']; 32 } 33 else 34 $max_width = 500; 31 $max_width = intval(get_option('large_size_w')); 32 $max_height = intval(get_option('large_size_h')); 33 if ( intval($content_width) > 0 ) 34 $max_width = min( intval($content_width), $max_width ); 35 } 36 // $size == 'full' has no constraint 37 else { 38 $max_width = $width; 39 $max_height = $height; 35 40 } 36 41 37 42 list( $max_width, $max_height ) = apply_filters( 'editor_max_image_size', array( $max_width, $max_height ), $size ); 38 43 39 44 return wp_constrain_dimensions( $width, $height, $max_width, $max_height ); 40 45 } … … 52 57 // Scale an image to fit a particular size (such as 'thumb' or 'medium'), and return an image URL, height and width. 53 58 // The URL might be the original image, or it might be a resized version. This function won't create a new resized copy, it will just return an already resized one if it exists. 54 // returns an array($url, $width, $height) 59 // returns an array($url, $width, $height, $is_intermediate) 60 // $is_intermediate is true if $url is a resized image, false if it is the original 55 61 function image_downsize($id, $size = 'medium') { 56 62 … … 61 67 $meta = wp_get_attachment_metadata($id); 62 68 $width = $height = 0; 69 $is_intermediate = false; 63 70 64 71 // plugins can use this to provide resize services … … 71 78 $width = $intermediate['width']; 72 79 $height = $intermediate['height']; 80 $is_intermediate = true; 73 81 } 74 82 elseif ( $size == 'thumbnail' ) { … … 78 86 $width = $info[0]; 79 87 $height = $info[1]; 88 $is_intermediate = true; 80 89 } 81 90 } 82 91 if ( !$width && !$height && isset($meta['width'], $meta['height']) ) { 83 // any other type: use the real image and constrain it 84 list( $width, $height ) = image_constrain_size_for_editor( $meta['width'], $meta['height'], $size ); 85 } 86 87 if ( $img_url) 88 return array( $img_url, $width, $height ); 92 // any other type: use the real image 93 $width = $meta['width']; 94 $height = $meta['height']; 95 } 96 97 if ( $img_url) { 98 // we have the actual image size, but might need to further constrain it if content_width is narrower 99 list( $width, $height ) = image_constrain_size_for_editor( $width, $height, $size ); 100 101 return array( $img_url, $width, $height, $is_intermediate ); 102 } 89 103 return false; 90 104 -
trunk/wp-includes/version.php
r8540 r8612 16 16 * @global int $wp_db_version 17 17 */ 18 $wp_db_version = 85 39;18 $wp_db_version = 8585; 19 19 20 20 ?>
Note: See TracChangeset
for help on using the changeset viewer.