Separate Large and Full image sizes. Props tellyworth. fixes #7151

git-svn-id: https://develop.svn.wordpress.org/trunk@8612 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-08-11 03:54:26 +00:00
parent 1c05d81e06
commit da4e0eca48
7 changed files with 88 additions and 30 deletions

View File

@@ -83,9 +83,17 @@ th { position: relative; }
display: none;
}
tr.image-size td {
width: 460px;
}
tr.image-size div.image-size-item {
float: left;
width: 25%;
margin: 0;
}
tr.image-size label {
display: inline;
margin: 0 1em 0 0;
margin: 0 0 0 1em;
}
.pinkynail {
max-width: 40px;
@@ -202,7 +210,7 @@ abbr.required {
padding: 1em 0;
}
#media-upload p.help {
#media-upload p.help, #media-upload label.help {
font-style: italic;
font-weight: normal;
}

View File

@@ -96,7 +96,7 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
$metadata['file'] = $file;
// make thumbnails and other intermediate sizes
$sizes = array('thumbnail', 'medium');
$sizes = array('thumbnail', 'medium', 'large');
$sizes = apply_filters('intermediate_image_sizes', $sizes);
foreach ($sizes as $size) {

View File

@@ -520,6 +520,41 @@ function media_upload_library() {
return wp_iframe( 'media_upload_library_form', $errors );
}
function image_size_input_fields($post, $checked='') {
// get a list of the actual pixel dimensions of each possible intermediate version of this image
$sizes = array();
$size_names = array('thumbnail' => 'Thumbnail', 'medium' => 'Medium', 'large' => 'Large', 'full' => 'Full size');
foreach ( $size_names as $size => $name) {
$downsize = image_downsize($post->ID, $size);
// is this size selectable?
$enabled = ( $downsize[3] || 'full' == $size );
$css_id = "image-size-{$size}-{$post->ID}";
// if $checked was not specified, default to the first available size that's bigger than a thumbnail
if ( !$checked && $enabled && 'thumbnail' != $size )
$checked = $size;
$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'" : '') ." />";
$html .= "<label for='{$css_id}'>" . __($name). "</label>";
// only show the dimensions if that choice is available
if ( $enabled )
$html .= " <label for='{$css_id}' class='help'>" . sprintf( __("(%d&nbsp;&times;&nbsp;%d)"), $downsize[1], $downsize[2] ). "</label>";
$html .= '</div>';
$out[] = $html;
}
return array(
'label' => __('Size'),
'input' => 'html',
'html' => join("\n", $out),
);
}
function image_attachment_fields_to_edit($form_fields, $post) {
if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
$form_fields['post_title']['required'] = true;
@@ -529,8 +564,6 @@ function image_attachment_fields_to_edit($form_fields, $post) {
$form_fields['post_content']['label'] = __('Description');
$thumb = wp_get_attachment_thumb_url($post->ID);
$form_fields['align'] = array(
'label' => __('Alignment'),
'input' => 'html',
@@ -544,17 +577,7 @@ function image_attachment_fields_to_edit($form_fields, $post) {
<input type='radio' name='attachments[$post->ID][align]' id='image-align-right-$post->ID' value='right' />
<label for='image-align-right-$post->ID' class='align image-align-right-label'>" . __('Right') . "</label>\n",
);
$form_fields['image-size'] = array(
'label' => __('Size'),
'input' => 'html',
'html' => "
" . ( $thumb ? "<input type='radio' name='attachments[$post->ID][image-size]' id='image-size-thumb-$post->ID' value='thumbnail' />
<label for='image-size-thumb-$post->ID'>" . __('Thumbnail') . "</label>
" : '' ) . "<input type='radio' name='attachments[$post->ID][image-size]' id='image-size-medium-$post->ID' value='medium' checked='checked' />
<label for='image-size-medium-$post->ID'>" . __('Medium') . "</label>
<input type='radio' name='attachments[$post->ID][image-size]' id='image-size-full-$post->ID' value='full' />
<label for='image-size-full-$post->ID'>" . __('Full size') . "</label>",
);
$form_fields['image-size'] = image_size_input_fields($post);
}
return $form_fields;
}

View File

@@ -258,6 +258,10 @@ function populate_options() {
add_option('enable_app', 0);
add_option('enable_xmlrpc', 0);
// 2.7
add_option('large_size_w', 1024);
add_option('large_size_h', 1024);
// Delete unused options
$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');
foreach ($unusedoptions as $option) :

View File

@@ -62,6 +62,15 @@ include('admin-header.php');
<input name="medium_size_h" type="text" id="medium_size_h" value="<?php form_option('medium_size_h'); ?>" size="6" />
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Large size') ?></th>
<td><fieldset><legend class="hidden"><?php _e('Large size') ?></legend>
<label for="large_size_w"><?php _e('Max Width'); ?></label>
<input name="large_size_w" type="text" id="large_size_w" value="<?php form_option('large_size_w'); ?>" size="6" />
<label for="large_size_h"><?php _e('Max Height'); ?></label>
<input name="large_size_h" type="text" id="large_size_h" value="<?php form_option('large_size_h'); ?>" size="6" />
</fieldset></td>
</tr>
</table>