Changeset 8612 for trunk/wp-admin/includes/media.php
- Timestamp:
- 08/11/2008 03:54:26 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note: See TracChangeset
for help on using the changeset viewer.