Ticket #8599: multiple_custom_image_sizes.3.patch
| File multiple_custom_image_sizes.3.patch, 34.9 KB (added by leogermani, 4 years ago) |
|---|
-
wp-includes/post.php
2601 2601 } 2602 2602 2603 2603 // remove intermediate and backup images if there are any 2604 $sizes = apply_filters('intermediate_image_sizes', array('thumbnail', 'medium', 'large'));2604 $sizes = get_intermediate_sizes(); 2605 2605 foreach ( $sizes as $size ) { 2606 2606 if ( $intermediate = image_get_intermediate_size($post_id, $size) ) { 2607 2607 $intermediate_file = apply_filters('wp_delete_file', $intermediate['path']); … … 2647 2647 $data = get_post_meta( $post->ID, '_wp_attachment_metadata', true ); 2648 2648 2649 2649 if ( $remove_backups && isset($data['sizes']) && is_array($data['sizes']) ) { 2650 $sizes = apply_filters( 'intermediate_image_sizes', array('large', 'medium', 'thumbnail'));2650 $sizes = get_intermediate_sizes(); 2651 2651 foreach ( $data['sizes'] as $size => $val ) { 2652 2652 if ( !in_array( $size, $sizes, true ) ) 2653 2653 unset($data['sizes'][$size]); -
wp-includes/media.php
486 486 } 487 487 488 488 /** 489 * Get the available image sizes 490 * @since 2.9 491 * @param bool $unfiltered Optional, default is false. If set to true, returns unfiltered data 492 * @return array Returns a filtered array of image size strings 493 */ 494 function get_intermediate_sizes($unfiltered = false) 495 { 496 $core = get_core_intermediate_sizes(true); 497 $custom = get_custom_intermediate_sizes(true); 498 499 $intermediate_sizes = array_merge($core, $custom); 500 501 if (!$unfiltered) 502 $intermediate_sizes = apply_filters('intermediate_image_sizes', $intermediate_sizes); 503 return $intermediate_sizes; 504 } 505 506 /** 507 * Get the core image sizes 508 * @since 2.9 509 * @param bool $unfiltered Optional, default is false. If set to true, returns unfiltered data 510 * @return array Returns a filtered array of image size strings 511 */ 512 function get_core_intermediate_sizes($unfiltered = false) 513 { 514 $intermediate_sizes = array(__('Thumbnail') => 'thumbnail', __('Medium') => 'medium', __('Large') => 'large'); 515 if (!$unfiltered) 516 $intermediate_sizes = apply_filters('intermediate_image_sizes', $intermediate_sizes); 517 return $intermediate_sizes; 518 } 519 520 /** 521 * Get the custom image sizes 522 * @since 2.9 523 * @param bool $unfiltered Optional, default is false. If set to true, returns unfiltered data 524 * @return array Returns a filtered array of image size strings 525 */ 526 function get_custom_intermediate_sizes($unfiltered = false) 527 { 528 $intermediate_sizes = array(); 529 $custom_sizes = get_option('custom_image_sizes'); 530 if (is_array($custom_sizes)) { 531 foreach ($custom_sizes as $size) { 532 $intermediate_sizes[$size] = sanitize_title_with_dashes($size); 533 } 534 } 535 536 if (!$unfiltered) 537 $intermediate_sizes = apply_filters('intermediate_image_sizes', $intermediate_sizes); 538 return $intermediate_sizes; 539 } 540 541 542 /** 489 543 * Retrieve an image to represent an attachment. 490 544 * 491 545 * A mime icon for files, thumbnail or intermediate size for images. -
wp-admin/admin-ajax.php
1373 1373 1374 1374 die(); 1375 1375 break; 1376 case 'custom-image-size-add' : 1377 1378 if (isset($_POST['new_size_name']) && $_POST['new_size_name'] != '') { 1379 $custom_sizes = get_option('custom_image_sizes'); 1380 $name = $_POST['new_size_name']; 1381 $slug = sanitize_title_with_dashes($name); 1382 $protected_names = array('Full size', 'Thumbnail', 'Medium', 'Large'); 1383 1384 if (is_array($custom_sizes)) { 1385 1386 // check for duplicates 1387 if ( in_array($name, $custom_sizes) ) { 1388 $suffix = 2; 1389 do { 1390 $alt_name = substr($name, 0, 200-(strlen($suffix)+1)). "-$suffix"; 1391 $check_name = in_array($alt_name, $custom_sizes); 1392 $suffix++; 1393 } while ($check_name); 1394 $name = $alt_name; 1395 $slug = sanitize_title_with_dashes($name); 1396 } 1397 array_push($custom_sizes, $name); 1398 } else { 1399 $custom_sizes = array($name); 1400 } 1401 1402 if (!in_array($name, $protected_names) && update_option('custom_image_sizes', $custom_sizes)) { 1403 $op = '<tr valign="top"> 1404 <th scope="row"> 1405 <span class="size_name"> 1406 ' . $name . ' 1407 </span> 1408 <p style="margin: 0;"> 1409 <a style="display: none; cursor: pointer;" class="remove_custom_size delete"> 1410 ' . __('Remove') . ' 1411 </a> 1412 </p> 1413 </th> 1414 <td> 1415 <label for="' . $slug . '_size_w">' . __('Max Width') . '</label> 1416 <input name="' . $slug . '_size_w" type="text" id="' . $slug . '_size_w" value="" class="small-text" /> 1417 <label for="' . $slug . '_size_h">' . __('Max Height') . '</label> 1418 <input name="' . $slug . '_size_h" type="text" id="' . $slug . '_size_h" value="" class="small-text" /><br /> 1419 <input name="' . $slug . '_crop" type="checkbox" id="' . $slug . '_crop" value="1" /> 1420 <label for="' . $slug . '_crop">' . __('Crop image to exact dimensions') . '</label> 1421 </td> 1422 </tr>'; 1423 1424 echo $op; 1425 } 1426 1427 } 1428 1429 break; 1430 1431 case 'custom-image-size-remove' : 1432 1433 $custom_sizes = get_option('custom_image_sizes'); 1434 $name = $_POST['size_name']; 1435 1436 if (is_array($custom_sizes)) { 1437 $key = array_search($name, $custom_sizes); 1438 array_splice($custom_sizes, $key, 1); 1439 1440 $slug = sanitize_title_with_dashes($name); 1441 delete_option($slug . '_size_w'); 1442 delete_option($slug . '_size_h'); 1443 delete_option($slug . '_crop'); 1444 1445 update_option('custom_image_sizes', $custom_sizes); 1446 echo 'ok'; 1447 } 1448 1449 1450 1451 break; 1452 1376 1453 default : 1377 1454 do_action( 'wp_ajax_' . $_POST['action'] ); 1378 1455 die('0'); -
wp-admin/includes/image-edit.php
13 13 14 14 $meta = wp_get_attachment_metadata($post_id); 15 15 if ( is_array($meta) && is_array($meta['sizes']) ) { 16 $sizes = apply_filters('intermediate_image_sizes', array('thumbnail', 'medium', 'large')); 17 $size_names = array( 18 'thumbnail' => __('thumbnail'), 19 'medium' => __('medium'), 20 'large' => __('large') 21 ); 22 23 foreach ( $sizes as $size ) { 16 $sizes = get_intermediate_sizes(); 17 foreach ( $sizes as $size_name => $size ) { 24 18 if ( array_key_exists($size, $meta['sizes']) ) { 25 $size_name = isset($size_names[$size]) ? $size_names[$size] : $size;26 19 $image_size_opt .= "<option value='$size'>$size_name</option>\n"; 27 20 } 28 21 } … … 371 364 $meta['hwstring_small'] = "height='$uheight' width='$uwidth'"; 372 365 373 366 if ( $success && $target == 'all' ) 374 $sizes = apply_filters( 'intermediate_image_sizes', array('large', 'medium', 'thumbnail'));367 $sizes = get_intermediate_sizes(); 375 368 376 369 $msg .= "full={$meta['width']}x{$meta['height']}!"; 377 370 } elseif ( array_key_exists($target, $meta['sizes']) ) { -
wp-admin/includes/media.php
797 797 function image_size_input_fields( $post, $checked = '' ) { 798 798 799 799 // get a list of the actual pixel dimensions of each possible intermediate version of this image 800 $size_names = array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full size')); 800 $size_names = get_intermediate_sizes(); 801 $size_names[__('Full size')] = 'full'; 801 802 802 foreach ( $size_names as $ size => $name ) {803 foreach ( $size_names as $name => $size ) { 803 804 $downsize = image_downsize($post->ID, $size); 804 805 805 806 // is this size selectable? -
wp-admin/includes/image.php
105 105 $metadata['file'] = $file; 106 106 107 107 // make thumbnails and other intermediate sizes 108 $sizes = array('thumbnail', 'medium', 'large'); 109 $sizes = apply_filters('intermediate_image_sizes', $sizes); 108 $sizes = get_intermediate_sizes(); 110 109 111 110 foreach ($sizes as $size) { 112 111 $resized = image_make_intermediate_size( $full_path_file, get_option("{$size}_size_w"), get_option("{$size}_size_h"), get_option("{$size}_crop") ); … … 294 293 } 295 294 296 295 /** 296 * Updates all image metadata and, by consequence, regenerates thumbnails 297 * 298 * @since 2.9.0 299 * 300 * @param int $attachment_id Attachment Id to process. 301 * @return Array|bool Attachment metadata. False on failure. 302 */ 303 function wp_update_image_thumbs($attachment_id) { 304 $fullsizepath = get_attached_file( $attachment_id ); 305 if ( FALSE !== $fullsizepath && @file_exists($fullsizepath) && file_is_valid_image($fullsizepath)) { 306 set_time_limit( 30 ); 307 if (wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $fullsizepath ) ) ) 308 return wp_get_attachment_metadata( $attachment_id ); 309 } 310 return false; 311 } 312 313 314 /** 297 315 * Validate that file is an image. 298 316 * 299 317 * @since 2.5.0 -
wp-admin/js/options-media.js
1 jQuery(document).ready(function($) { 2 3 $('.remove_custom_size').hide().removeAttr('href'); 4 5 $('form').submit(function() { 6 $('#new_size').val(''); 7 }); 8 9 $('#new_size').keypress(function(e) { 10 if (13 == e.keyCode){ 11 addNewSize(); 12 return false; 13 } 14 }).after('<a style="cursor: pointer;" id="add_new_size">'+messages.add_label+'</a>'); 15 16 $('#add_new_size').click(function() { 17 addNewSize(); 18 }); 19 20 $('#image_sizes_table').find('tr').mouseover(function() { 21 new_size_over($(this)) 22 }).mouseout(function() { 23 new_size_out($(this)); 24 }).find('.remove_custom_size').click(function() { 25 remove_custom_size($(this)); 26 }); 27 28 function new_size_over(tr) { 29 tr.find('.remove_custom_size').show(); 30 } 31 32 function new_size_out(tr) { 33 tr.find('.remove_custom_size').hide(); 34 } 35 36 function remove_custom_size(button) { 37 if (confirm(messages.confirm_remove)) { 38 var name = button.parents('th').find('span.size_name').html(); 39 del_size = $.ajax({ 40 type: 'POST', 41 url: ajaxurl, 42 dataType: 'html', 43 data: { 44 size_name: name, 45 action: 'custom-image-size-remove' 46 }, 47 48 complete: function() { 49 if (del_size.responseText == 'ok') { 50 button.parents('tr').animate({backgroundColor: "#bf5e5e"}, 300).animate({opacity: "hide"}, 1000, "", function(){ 51 $(this).remove(); 52 }); 53 } else 54 alert(messages.error_remove); 55 } 56 }); 57 } 58 } 59 60 function addNewSize() { 61 62 var sizeName = $('#new_size').val(); 63 if (!sizeName) { 64 alert(messages.error_add_blank); 65 return; 66 } 67 new_size = $.ajax({ 68 type: 'POST', 69 url: ajaxurl, 70 dataType: 'html', 71 data: { 72 new_size_name: sizeName, 73 action: 'custom-image-size-add' 74 }, 75 76 complete: function() { 77 if (new_size.responseText) { 78 var htmlBgColor = $('html').css('backgroundColor'); 79 $('#image_sizes_table').append(new_size.responseText).find('tr:last').css('background-color', htmlBgColor).animate({backgroundColor: "#FFFFE0"}, 400).animate({backgroundColor: htmlBgColor}, 1000).mouseover(function() { 80 new_size_over($(this)); 81 }).mouseout(function() { 82 new_size_out($(this)); 83 }).find('.remove_custom_size').click(function() { 84 remove_custom_size($(this)); 85 }); 86 } else { 87 alert(messages.error_add); 88 } 89 } 90 }); 91 92 } 93 94 95 }); -
wp-admin/options-media.php
9 9 /** WordPress Administration Bootstrap */ 10 10 require_once('admin.php'); 11 11 12 wp_enqueue_script('options-media', admin_url() . '/js/options-media.js', array('jquery')); 13 wp_localize_script('options-media', 'messages', array( 14 'confirm_remove' => __('Are you sure you want to remove this size?'), 15 'error_remove' => __('Fail to remove this size'), 16 'error_add' => __('Fail to add size. Try using a different name'), 17 'error_add_blank' => __('Please fill in a name for the new size'), 18 'add_label' => __('Add') 19 )); 20 21 // Handle delete custom size 22 if ($_GET['action'] == 'delete_custom_size' && $_GET['size_name'] != '') { 23 24 $custom_sizes = get_option('custom_image_sizes'); 25 $name = $_GET['size_name']; 26 27 if (is_array($custom_sizes)) { 28 $key = array_search($name, $custom_sizes); 29 array_splice($custom_sizes, $key, 1); 30 31 $slug = sanitize_title_with_dashes($name); 32 delete_option($slug . '_size_w'); 33 delete_option($slug . '_size_h'); 34 delete_option($slug . '_crop'); 35 36 update_option('custom_image_sizes', $custom_sizes); 37 $goback = add_query_arg( 'updated', 'true', wp_get_referer() ); 38 wp_redirect( $goback ); 39 } 40 41 } 42 12 43 if ( ! current_user_can('manage_options') ) 13 44 wp_die(__('You do not have sufficient permissions to manage options for this blog.')); 14 45 … … 23 54 <?php screen_icon(); ?> 24 55 <h2><?php echo esc_html( $title ); ?></h2> 25 56 26 <form action="options.php" method="post"> 27 <?php settings_fields('media'); ?> 57 <?php if (!$_POST['regen-thumbs']) : ?> 58 <form action="options.php" method="post"> 59 <?php settings_fields('media'); ?> 28 60 29 <h3><?php _e('Image sizes') ?></h3>30 <p><?php _e('The sizes listed below determine the maximum dimensions in pixels to use when inserting an image into the body of a post.'); ?></p>61 <h3><?php _e('Image sizes') ?></h3> 62 <p><?php _e('The sizes listed below determine the maximum dimensions in pixels to use when inserting an image into the body of a post.'); ?></p> 31 63 32 <table class="form-table">33 <tr valign="top">34 <th scope="row"><?php _e('Thumbnail size') ?></th>35 <td>36 <label for="thumbnail_size_w"><?php _e('Width'); ?></label>37 <input name="thumbnail_size_w" type="text" id="thumbnail_size_w" value="<?php form_option('thumbnail_size_w'); ?>" class="small-text" />38 <label for="thumbnail_size_h"><?php _e('Height'); ?></label>39 <input name="thumbnail_size_h" type="text" id="thumbnail_size_h" value="<?php form_option('thumbnail_size_h'); ?>" class="small-text" /><br />40 <input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked('1', get_option('thumbnail_crop')); ?>/>41 <label for="thumbnail_crop"><?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?></label>42 </td>43 </tr>64 <table class="form-table" id="image_sizes_table"> 65 <tr valign="top"> 66 <th scope="row"><?php _e('Thumbnail size') ?></th> 67 <td> 68 <label for="thumbnail_size_w"><?php _e('Width'); ?></label> 69 <input name="thumbnail_size_w" type="text" id="thumbnail_size_w" value="<?php form_option('thumbnail_size_w'); ?>" class="small-text" /> 70 <label for="thumbnail_size_h"><?php _e('Height'); ?></label> 71 <input name="thumbnail_size_h" type="text" id="thumbnail_size_h" value="<?php form_option('thumbnail_size_h'); ?>" class="small-text" /><br /> 72 <input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked('1', get_option('thumbnail_crop')); ?>/> 73 <label for="thumbnail_crop"><?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?></label> 74 </td> 75 </tr> 44 76 45 <tr valign="top">46 <th scope="row"><?php _e('Medium size') ?></th>47 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Medium size') ?></span></legend>48 <label for="medium_size_w"><?php _e('Max Width'); ?></label>49 <input name="medium_size_w" type="text" id="medium_size_w" value="<?php form_option('medium_size_w'); ?>" class="small-text" />50 <label for="medium_size_h"><?php _e('Max Height'); ?></label>51 <input name="medium_size_h" type="text" id="medium_size_h" value="<?php form_option('medium_size_h'); ?>" class="small-text" />52 </fieldset></td>53 </tr>77 <tr valign="top"> 78 <th scope="row"><?php _e('Medium size') ?></th> 79 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Medium size') ?></span></legend> 80 <label for="medium_size_w"><?php _e('Max Width'); ?></label> 81 <input name="medium_size_w" type="text" id="medium_size_w" value="<?php form_option('medium_size_w'); ?>" class="small-text" /> 82 <label for="medium_size_h"><?php _e('Max Height'); ?></label> 83 <input name="medium_size_h" type="text" id="medium_size_h" value="<?php form_option('medium_size_h'); ?>" class="small-text" /> 84 </fieldset></td> 85 </tr> 54 86 55 <tr valign="top">56 <th scope="row"><?php _e('Large size') ?></th>57 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Large size') ?></span></legend>58 <label for="large_size_w"><?php _e('Max Width'); ?></label>59 <input name="large_size_w" type="text" id="large_size_w" value="<?php form_option('large_size_w'); ?>" class="small-text" />60 <label for="large_size_h"><?php _e('Max Height'); ?></label>61 <input name="large_size_h" type="text" id="large_size_h" value="<?php form_option('large_size_h'); ?>" class="small-text" />62 </fieldset></td>63 </tr>87 <tr valign="top"> 88 <th scope="row"><?php _e('Large size') ?></th> 89 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Large size') ?></span></legend> 90 <label for="large_size_w"><?php _e('Max Width'); ?></label> 91 <input name="large_size_w" type="text" id="large_size_w" value="<?php form_option('large_size_w'); ?>" class="small-text" /> 92 <label for="large_size_h"><?php _e('Max Height'); ?></label> 93 <input name="large_size_h" type="text" id="large_size_h" value="<?php form_option('large_size_h'); ?>" class="small-text" /> 94 </fieldset></td> 95 </tr> 64 96 65 <?php do_settings_fields('media', 'default'); ?> 66 </table> 97 <?php 67 98 68 <?php do_settings_sections('media'); ?> 99 $custom_sizes = get_custom_intermediate_sizes(); 69 100 70 <p class="submit"> 71 <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" /> 72 </p> 101 if (is_array($custom_sizes)) : 102 foreach ($custom_sizes as $name => $size) : 103 ?> 104 <tr valign="top"> 105 <th scope="row"> 106 <span class="size_name"><?php echo $name; ?></span> 107 <p style="margin: 0;"> 108 <a style="cursor: pointer;" class="remove_custom_size delete" href="<?php echo add_query_arg(array('action' => 'delete_custom_size', 'size_name' => $name)); ?>"> 109 <?php _e('Remove'); ?> 110 </a> 111 </p> 112 </th> 113 <td> 114 <label for="<?php echo $size; ?>_size_w"><?php _e('Max Width'); ?></label> 115 <input name="<?php echo $size; ?>_size_w" type="text" id="<?php echo $size; ?>_size_w" value="<?php form_option($size . '_size_w'); ?>" class="small-text" /> 116 <label for="<?php echo $size; ?>_size_h"><?php _e('Max Height'); ?></label> 117 <input name="<?php echo $size; ?>_size_h" type="text" id="<?php echo $size; ?>_size_h" value="<?php form_option($size . '_size_h'); ?>" class="small-text" /><br /> 118 <input name="<?php echo $size; ?>_crop" type="checkbox" id="<?php echo $size; ?>_crop" value="1" <?php checked('1', get_option($size . '_crop')); ?>/> 119 <label for="<?php echo $size; ?>_crop"><?php _e('Crop image to exact dimensions'); ?></label> 120 </td> 121 </tr> 73 122 74 </form> 123 <?php 124 endforeach; 125 endif; //is_array($custom_sizes) 75 126 127 ?> 128 </table> 129 130 <table class="form-table"> 131 <tr valign="top"> 132 <th scope="row"><?php _e('Add new') ?></th> 133 <td> 134 <label for="new_size"><?php _e('New size name'); ?></label> 135 <input name="new_size" type="text" id="new_size" value="" /> 136 137 </td> 138 </tr> 139 140 141 <?php do_settings_fields('media', 'default'); ?> 142 </table> 143 144 145 <?php do_settings_sections('media'); ?> 146 147 <p class="submit"> 148 <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" /> 149 </p> 150 151 </form> 152 153 <h2><?php _e('Regenerate all thumbnails'); ?></h2> 154 155 <form method="post" action="<?php echo remove_query_arg('updated'); ?>"> 156 157 <p><?php _e('If you change the values of the sizes you might want to regenerate all your image thumbnails to fit the new values. (Please note that if you have a lot of images this proccess can take a long time)'); ?></p> 158 159 <p class="submit"> 160 <input type="submit" name="regen-thumbs" class="button-primary" value="<?php esc_attr_e('Regenerate all thumbnails') ?>" /> 161 </p> 162 163 </form> 164 165 <?php else : // not regenerating thumbs ?> 166 167 <h2><?php _e('Regenarating thumbnails'); ?></h2> 168 169 <p><?php _e('This proccess can take a while depending on the number of images you have. Leave this window open while it proccess.'); ?></p> 170 171 <?php 172 173 $attachments =& get_children( array( 174 'post_type' => 'attachment', 175 'post_mime_type' => 'image', 176 'numberposts' => -1, 177 'post_status' => null, 178 'post_parent' => null, // any parent 179 'output' => 'object', 180 ) ); 181 182 // Check for results 183 if ( FALSE === $attachments ) { 184 echo ' <p>' . __( "No images were found." ) . "</p>\n\n"; 185 } else { 186 $count = 0; 187 echo " <ol>\n"; 188 foreach ( $attachments as $attachment ) { 189 $lastImage = wp_update_image_thumbs($attachment->ID); 190 echo '<li>', $lastImage['file'], '</li>'; 191 $count ++; 192 ob_flush(); 193 flush(); 194 } 195 echo " </ol>\n\n"; 196 echo ' <p>' . sprintf( __( 'All done! Processed %d attachments.' ), $count ); 197 echo ' <a href="', admin_url(), 'options-media.php">', __('Go back'), '.</a>'; 198 echo "</p>\n\n"; 199 } 200 ?> 201 202 <?php endif; ?> 203 76 204 </div> 77 205 78 206 <?php include('./admin-footer.php'); ?> -
wp-admin/options.php
25 25 'general' => array( 'blogname', 'blogdescription', 'admin_email', 'users_can_register', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'default_role', 'timezone_string' ), 26 26 'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ), 27 27 'misc' => array( 'use_linksupdate', 'uploads_use_yearmonth_folders', 'upload_path', 'upload_url_path' ), 28 'media' => array( ' thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ),28 'media' => array( 'image_default_size', 'image_default_align', 'image_default_link_type' ), 29 29 'privacy' => array( 'blog_public' ), 30 30 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ), 31 31 'writing' => array( 'default_post_edit_rows', 'use_smilies', 'ping_sites', 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'enable_app', 'enable_xmlrpc' ), … … 33 33 if ( !defined( 'WP_SITEURL' ) ) $whitelist_options['general'][] = 'siteurl'; 34 34 if ( !defined( 'WP_HOME' ) ) $whitelist_options['general'][] = 'home'; 35 35 36 // Get image sizes 37 if ($image_sizes = get_intermediate_sizes()) { 38 foreach ($image_sizes as $size) { 39 array_push($whitelist_options['media'], $size . '_size_w'); 40 array_push($whitelist_options['media'], $size . '_size_h'); 41 array_push($whitelist_options['media'], $size . '_crop'); 42 } 43 } 44 36 45 $whitelist_options = apply_filters( 'whitelist_options', $whitelist_options ); 37 46 38 47 if ( !current_user_can('manage_options') ) … … 67 76 $_POST['time_format'] = $_POST['time_format_custom']; 68 77 } 69 78 79 // Handle custom image sizes 80 if (isset($_POST['new_size']) && $_POST['new_size'] != '') { 81 $custom_sizes = get_option('custom_image_sizes'); 82 $newCustomSizeName = $_POST['new_size']; 83 $protected_names = array('Full size', 'Thumbnail', 'Medium', 'Large'); 84 if (is_array($custom_sizes)) { 85 // check for duplicates 86 if ( in_array($newCustomSizeName, $custom_sizes) ) { 87 $suffix = 2; 88 do { 89 $alt_name = substr($newCustomSizeName, 0, 200-(strlen($suffix)+1)). "-$suffix"; 90 $check_name = in_array($alt_name, $custom_sizes); 91 $suffix++; 92 } while ($check_name); 93 $newCustomSizeName = $alt_name; 94 } 95 array_push($custom_sizes, $newCustomSizeName); 96 } else { 97 $custom_sizes = array($newCustomSizeName); 98 } 99 if (!in_array($newCustomSizeName, $protected_names)) update_option('custom_image_sizes', $custom_sizes); 100 } 101 70 102 if ( $options ) { 71 103 foreach ( $options as $option ) { 72 104 $option = trim($option); -
wp-admin/css/media.css
1 div#media-upload-header{margin:0;padding:0 5px;font-weight:bold;position:relative;border-bottom-width:1px;border-bottom-style:solid;height:2.5em;}body#media-upload ul#sidemenu{font-weight:normal;margin:0 5px;position:absolute;left:0;bottom:-1px;}div#media-upload-error{margin:1em;font-weight:bold;}form{margin:1em;}#search-filter{text-align:right;}th{position:relative;}.media-upload-form label.form-help,td.help{font-family:"Lucida Grande","Bitstream Vera Sans",Verdana,Arial,sans-serif;font-style:italic;font-weight:normal;}.media-upload-form p.help{margin:0;padding:0;}.media-upload-form fieldset{width:100%;border:none;text-align:justify;margin:0 0 1em 0;padding:0;}.image-align-none-label{background:url(../images/align-none.png) no-repeat center left;}.image-align-left-label{background:url(../images/align-left.png) no-repeat center left;}.image-align-center-label{background:url(../images/align-center.png) no-repeat center left;}.image-align-right-label{background:url(../images/align-right.png) no-repeat center left;}tr.image-size td{width:460px;}tr.image-size div.image-size-item{float:left;width:25%;margin:0; }#library-form .progress,#gallery-form .progress,#flash-upload-ui,.insert-gallery,.describe.startopen,.describe.startclosed{display:none;}.media-item .thumbnail{max-width:128px;max-height:128px;}thead.media-item-info tr{background-color:transparent;}thead.media-item-info th,thead.media-item-info td{border:none;margin:0;}.form-table thead.media-item-info{border:8px solid #fff;}abbr.required{text-decoration:none;border:none;}.describe label{display:inline;}.describe td{vertical-align:middle;padding:0 5px 0 0;}.describe td.A1{width:132px;}.describe input[type="text"],.describe textarea{width:460px;border-width:1px;border-style:solid;}.describe-toggle-on,.describe-toggle-off{display:block;line-height:36px;float:right;margin-right:20px;}.describe-toggle-off{display:none;}.hidden{height:0;width:0;overflow:hidden;border:none;}#media-upload .media-upload-form p{margin:0 1em 1em 0;}#media-upload p.ml-submit{padding:1em 0;}#media-upload p.help,#media-upload label.help{font-family:"Lucida Grande","Bitstream Vera Sans",Verdana,Arial,sans-serif;font-style:italic;font-weight:normal;}#media-upload tr.image-size td.field{text-align:center;}#media-upload #media-items{border-width:1px;border-style:solid;border-bottom:none;width:623px;}#media-upload .media-item{border-bottom-width:1px;border-bottom-style:solid;min-height:36px;width:100%;}#media-upload .ui-sortable .media-item{cursor:move;}.filename{line-height:36px;padding:0 10px;overflow:hidden;}#media-upload .describe{padding:5px;width:100%;clear:both;cursor:default;}#media-upload .slidetoggle{border-top-width:1px;border-top-style:solid;}#media-upload .describe th.label{padding-top:.5em;text-align:left;min-width:120px;}#media-upload tr.align td.field{text-align:center;}#media-upload tr.image-size{margin-bottom:1em;height:3em;}#media-upload #filter{width:623px;}#media-upload #filter .subsubsub{margin:8px 0;}#filter .tablenav select{border-style:solid;border-width:1px;padding:2px;vertical-align:top;width:auto;}#media-upload .del-attachment{display:none;margin:5px 0;}.menu_order{float:right;font-size:11px;margin:10px 10px 0;}.menu_order_input{border:1px solid #ddd;font-size:10px;padding:1px;width:23px;}.ui-sortable-helper{background-color:#fff;border:1px solid #aaa;opacity:.6;filter:alpha(opacity=60);}#media-upload th.order-head{width:25%;text-align:center;}#media-upload .widefat{width:626px;border-style:solid solid none;}.sorthelper{height:37px;width:623px;display:block;}#gallery-settings th.label{width:160px;}#gallery-settings #basic th.label{padding:5px 5px 5px 0;}#gallery-settings .title{clear:both;padding:0 0 3px;border-bottom-style:solid;border-bottom-width:1px;font-family:Georgia,"Times New Roman",Times,serif;font-size:1.6em;border-bottom-color:#DADADA;color:#5A5A5A;}h3.media-title{color:#5A5A5A;font-family:Georgia,"Times New Roman",Times,serif;font-size:1.6em;font-weight:normal;}#gallery-settings .describe td{vertical-align:middle;height:3.5em;}#gallery-settings .describe th.label{padding-top:.5em;text-align:left;}#gallery-settings .describe{padding:5px;width:615px;clear:both;cursor:default;}#gallery-settings .describe select{width:15em;border:1px solid #dfdfdf;}#gallery-settings label,#gallery-settings legend{font-size:13px;color:#464646;margin-right:15px;}#gallery-settings .align .field label{margin:0 1.5em 0 0;}#gallery-settings p.ml-submit{border-top:1px solid #dfdfdf;}#gallery-settings select#columns{width:6em;}#sort-buttons{font-size:.8em;margin:3px 25px -8px 0;text-align:right;max-width:625px;}#sort-buttons a{text-decoration:none;}#sort-buttons #asc,#sort-buttons #showall{padding-left:5px;}#sort-buttons span{margin-right:25px;}2 No newline at end of file 1 div#media-upload-header{margin:0;padding:0 5px;font-weight:bold;position:relative;border-bottom-width:1px;border-bottom-style:solid;height:2.5em;}body#media-upload ul#sidemenu{font-weight:normal;margin:0 5px;position:absolute;left:0;bottom:-1px;}div#media-upload-error{margin:1em;font-weight:bold;}form{margin:1em;}#search-filter{text-align:right;}th{position:relative;}.media-upload-form label.form-help,td.help{font-family:"Lucida Grande","Bitstream Vera Sans",Verdana,Arial,sans-serif;font-style:italic;font-weight:normal;}.media-upload-form p.help{margin:0;padding:0;}.media-upload-form fieldset{width:100%;border:none;text-align:justify;margin:0 0 1em 0;padding:0;}.image-align-none-label{background:url(../images/align-none.png) no-repeat center left;}.image-align-left-label{background:url(../images/align-left.png) no-repeat center left;}.image-align-center-label{background:url(../images/align-center.png) no-repeat center left;}.image-align-right-label{background:url(../images/align-right.png) no-repeat center left;}tr.image-size td{width:460px;}tr.image-size div.image-size-item{float:left;width:25%;margin:0;min-height: 45px;height: auto !important;height: 45px;}#library-form .progress,#gallery-form .progress,#flash-upload-ui,.insert-gallery,.describe.startopen,.describe.startclosed{display:none;}.media-item .thumbnail{max-width:128px;max-height:128px;}thead.media-item-info tr{background-color:transparent;}thead.media-item-info th,thead.media-item-info td{border:none;margin:0;}.form-table thead.media-item-info{border:8px solid #fff;}abbr.required{text-decoration:none;border:none;}.describe label{display:inline;}.describe td{vertical-align:middle;padding:0 5px 0 0;}.describe td.A1{width:132px;}.describe input[type="text"],.describe textarea{width:460px;border-width:1px;border-style:solid;}.describe-toggle-on,.describe-toggle-off{display:block;line-height:36px;float:right;margin-right:20px;}.describe-toggle-off{display:none;}.hidden{height:0;width:0;overflow:hidden;border:none;}#media-upload .media-upload-form p{margin:0 1em 1em 0;}#media-upload p.ml-submit{padding:1em 0;}#media-upload p.help,#media-upload label.help{font-family:"Lucida Grande","Bitstream Vera Sans",Verdana,Arial,sans-serif;font-style:italic;font-weight:normal;}#media-upload tr.image-size td.field{text-align:center;}#media-upload #media-items{border-width:1px;border-style:solid;border-bottom:none;width:623px;}#media-upload .media-item{border-bottom-width:1px;border-bottom-style:solid;min-height:36px;width:100%;}#media-upload .ui-sortable .media-item{cursor:move;}.filename{line-height:36px;padding:0 10px;overflow:hidden;}#media-upload .describe{padding:5px;width:100%;clear:both;cursor:default;}#media-upload .slidetoggle{border-top-width:1px;border-top-style:solid;}#media-upload .describe th.label{padding-top:.5em;text-align:left;min-width:120px;}#media-upload tr.align td.field{text-align:center;}#media-upload tr.image-size{margin-bottom:1em;height:3em;}#media-upload #filter{width:623px;}#media-upload #filter .subsubsub{margin:8px 0;}#filter .tablenav select{border-style:solid;border-width:1px;padding:2px;vertical-align:top;width:auto;}#media-upload .del-attachment{display:none;margin:5px 0;}.menu_order{float:right;font-size:11px;margin:10px 10px 0;}.menu_order_input{border:1px solid #ddd;font-size:10px;padding:1px;width:23px;}.ui-sortable-helper{background-color:#fff;border:1px solid #aaa;opacity:.6;filter:alpha(opacity=60);}#media-upload th.order-head{width:25%;text-align:center;}#media-upload .widefat{width:626px;border-style:solid solid none;}.sorthelper{height:37px;width:623px;display:block;}#gallery-settings th.label{width:160px;}#gallery-settings #basic th.label{padding:5px 5px 5px 0;}#gallery-settings .title{clear:both;padding:0 0 3px;border-bottom-style:solid;border-bottom-width:1px;font-family:Georgia,"Times New Roman",Times,serif;font-size:1.6em;border-bottom-color:#DADADA;color:#5A5A5A;}h3.media-title{color:#5A5A5A;font-family:Georgia,"Times New Roman",Times,serif;font-size:1.6em;font-weight:normal;}#gallery-settings .describe td{vertical-align:middle;height:3.5em;}#gallery-settings .describe th.label{padding-top:.5em;text-align:left;}#gallery-settings .describe{padding:5px;width:615px;clear:both;cursor:default;}#gallery-settings .describe select{width:15em;border:1px solid #dfdfdf;}#gallery-settings label,#gallery-settings legend{font-size:13px;color:#464646;margin-right:15px;}#gallery-settings .align .field label{margin:0 1.5em 0 0;}#gallery-settings p.ml-submit{border-top:1px solid #dfdfdf;}#gallery-settings select#columns{width:6em;}#sort-buttons{font-size:.8em;margin:3px 25px -8px 0;text-align:right;max-width:625px;}#sort-buttons a{text-decoration:none;}#sort-buttons #asc,#sort-buttons #showall{padding-left:5px;}#sort-buttons span{margin-right:25px;} 2 No newline at end of file -
wp-admin/css/media.dev.css
79 79 float: left; 80 80 width: 25%; 81 81 margin: 0; 82 min-height: 45px; 83 height: auto !important; 84 height: 45px; 82 85 } 83 86 84 87 #library-form .progress,
