Ticket #8599: multiple_custom_image_sizes.4.patch
| File multiple_custom_image_sizes.4.patch, 38.1 KB (added by leogermani, 4 years ago) |
|---|
-
wp-includes/post.php
2751 2751 } 2752 2752 2753 2753 // remove intermediate and backup images if there are any 2754 $sizes = apply_filters('intermediate_image_sizes', array('thumbnail', 'medium', 'large'));2754 $sizes = get_intermediate_sizes(); 2755 2755 foreach ( $sizes as $size ) { 2756 2756 if ( $intermediate = image_get_intermediate_size($post_id, $size) ) { 2757 2757 $intermediate_file = apply_filters('wp_delete_file', $intermediate['path']); -
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
1409 1409 } 1410 1410 } 1411 1411 die( '0' ); 1412 case 'custom-image-size-add' : 1413 if (isset($_POST['new_size_name']) && $_POST['new_size_name'] != '') { 1414 $custom_sizes = get_option('custom_image_sizes'); 1415 $name = $_POST['new_size_name']; 1416 $slug = sanitize_title_with_dashes($name); 1417 $protected_names = array('Full size', 'Thumbnail', 'Medium', 'Large'); 1418 1419 if (is_array($custom_sizes)) { 1420 1421 // check for duplicates 1422 if ( in_array($name, $custom_sizes) ) { 1423 $suffix = 2; 1424 do { 1425 $alt_name = substr($name, 0, 200-(strlen($suffix)+1)). "-$suffix"; 1426 $check_name = in_array($alt_name, $custom_sizes); 1427 $suffix++; 1428 } while ($check_name); 1429 $name = $alt_name; 1430 $slug = sanitize_title_with_dashes($name); 1431 } 1432 array_push($custom_sizes, $name); 1433 } else { 1434 $custom_sizes = array($name); 1435 } 1436 1437 if (!in_array($name, $protected_names) && update_option('custom_image_sizes', $custom_sizes)) { 1438 $op = '<tr valign="top"> 1439 <th scope="row"> 1440 <span class="size_name"> 1441 ' . $name . ' 1442 </span> 1443 <p style="margin: 0;"> 1444 <a style="display: none; cursor: pointer;" class="remove_custom_size delete"> 1445 ' . __('Remove') . ' 1446 </a> 1447 </p> 1448 </th> 1449 <td> 1450 <label for="' . $slug . '_size_w">' . __('Max Width') . '</label> 1451 <input name="' . $slug . '_size_w" type="text" id="' . $slug . '_size_w" value="" class="small-text" /> 1452 <label for="' . $slug . '_size_h">' . __('Max Height') . '</label> 1453 <input name="' . $slug . '_size_h" type="text" id="' . $slug . '_size_h" value="" class="small-text" /><br /> 1454 <input name="' . $slug . '_crop" type="checkbox" id="' . $slug . '_crop" value="1" /> 1455 <label for="' . $slug . '_crop">' . __('Crop image to exact dimensions') . '</label> 1456 </td> 1457 </tr>'; 1458 1459 echo $op; 1460 } 1461 1462 } 1463 1464 break; 1465 case 'custom-image-size-remove' : 1466 $custom_sizes = get_option('custom_image_sizes'); 1467 $name = $_POST['size_name']; 1468 1469 if (is_array($custom_sizes)) { 1470 $key = array_search($name, $custom_sizes); 1471 array_splice($custom_sizes, $key, 1); 1472 1473 $slug = sanitize_title_with_dashes($name); 1474 delete_option($slug . '_size_w'); 1475 delete_option($slug . '_size_h'); 1476 delete_option($slug . '_crop'); 1477 1478 update_option('custom_image_sizes', $custom_sizes); 1479 echo 'ok'; 1480 } 1481 break; 1412 1482 default : 1413 1483 do_action( 'wp_ajax_' . $_POST['action'] ); 1414 1484 die('0'); -
wp-admin/includes/image-edit.php
444 444 445 445 $parts = pathinfo($meta['file']); 446 446 $suffix = time() . rand(100, 999); 447 $default_sizes = apply_filters( 'intermediate_image_sizes', array('large', 'medium', 'thumbnail'));447 $default_sizes = get_intermediate_sizes(); 448 448 $default_sizes[] = 'full'; 449 449 450 450 foreach ( $default_sizes as $default_size ) { … … 585 585 $meta['hwstring_small'] = "height='$uheight' width='$uwidth'"; 586 586 587 587 if ( $success && ('nothumb' == $target || 'all' == $target) ) { 588 $sizes = apply_filters( 'intermediate_image_sizes', array('large', 'medium', 'thumbnail'));588 $sizes = get_intermediate_sizes(); 589 589 if ( 'nothumb' == $target ) 590 590 $sizes = array_diff( $sizes, array('thumbnail') ); 591 591 } -
wp-admin/includes/media.php
804 804 function image_size_input_fields( $post, $checked = '' ) { 805 805 806 806 // get a list of the actual pixel dimensions of each possible intermediate version of this image 807 $size_names = array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full size')); 807 $size_names = get_intermediate_sizes(); 808 $size_names[__('Full size')] = 'full'; 808 809 809 foreach ( $size_names as $ size => $name ) {810 foreach ( $size_names as $name => $size ) { 810 811 $downsize = image_downsize($post->ID, $size); 811 812 812 813 // 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.which){ 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 … … 22 53 <div class="wrap"> 23 54 <?php screen_icon(); ?> 24 55 <h2><?php echo esc_html( $title ); ?></h2> 56 <?php if (!$_POST['regen-thumbs']) : ?> 57 <form action="options.php" method="post"> 58 <?php settings_fields('media'); ?> 25 59 26 <form action="options.php" method="post">27 <?php settings_fields('media'); ?>60 <h3><?php _e('Image sizes') ?></h3> 61 <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> 28 62 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> 63 <table class="form-table" id="image_sizes_table"> 64 <tr valign="top"> 65 <th scope="row"><?php _e('Thumbnail size') ?></th> 66 <td> 67 <label for="thumbnail_size_w"><?php _e('Width'); ?></label> 68 <input name="thumbnail_size_w" type="text" id="thumbnail_size_w" value="<?php form_option('thumbnail_size_w'); ?>" class="small-text" /> 69 <label for="thumbnail_size_h"><?php _e('Height'); ?></label> 70 <input name="thumbnail_size_h" type="text" id="thumbnail_size_h" value="<?php form_option('thumbnail_size_h'); ?>" class="small-text" /><br /> 71 <input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked('1', get_option('thumbnail_crop')); ?>/> 72 <label for="thumbnail_crop"><?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?></label> 73 </td> 74 </tr> 31 75 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> 76 <tr valign="top"> 77 <th scope="row"><?php _e('Medium size') ?></th> 78 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Medium size'); ?></span></legend> 79 <label for="medium_size_w"><?php _e('Max Width'); ?></label> 80 <input name="medium_size_w" type="text" id="medium_size_w" value="<?php form_option('medium_size_w'); ?>" class="small-text" /> 81 <label for="medium_size_h"><?php _e('Max Height'); ?></label> 82 <input name="medium_size_h" type="text" id="medium_size_h" value="<?php form_option('medium_size_h'); ?>" class="small-text" /> 83 </fieldset></td> 84 </tr> 44 85 45 <tr valign="top">46 <th scope="row"><?php _e('Mediumsize') ?></th>47 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Mediumsize'); ?></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>86 <tr valign="top"> 87 <th scope="row"><?php _e('Large size') ?></th> 88 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Large size'); ?></span></legend> 89 <label for="large_size_w"><?php _e('Max Width'); ?></label> 90 <input name="large_size_w" type="text" id="large_size_w" value="<?php form_option('large_size_w'); ?>" class="small-text" /> 91 <label for="large_size_h"><?php _e('Max Height'); ?></label> 92 <input name="large_size_h" type="text" id="large_size_h" value="<?php form_option('large_size_h'); ?>" class="small-text" /> 93 </fieldset></td> 94 </tr> 54 95 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> 96 <?php 97 98 $custom_sizes = get_custom_intermediate_sizes(); 99 100 if (is_array($custom_sizes)) : 101 foreach ($custom_sizes as $name => $size) : 102 ?> 103 <tr valign="top"> 104 <th scope="row"> 105 <span class="size_name"><?php echo $name; ?></span> 106 <p style="margin: 0;"> 107 <a style="cursor: pointer;" class="remove_custom_size delete" href="<?php echo add_query_arg(array('action' => 'delete_custom_size', 'size_name' => $name)); ?>"> 108 <?php _e('Remove'); ?> 109 </a> 110 </p> 111 </th> 112 <td> 113 <label for="<?php echo $size; ?>_size_w"><?php _e('Max Width'); ?></label> 114 <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" /> 115 <label for="<?php echo $size; ?>_size_h"><?php _e('Max Height'); ?></label> 116 <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 /> 117 <input name="<?php echo $size; ?>_crop" type="checkbox" id="<?php echo $size; ?>_crop" value="1" <?php checked('1', get_option($size . '_crop')); ?>/> 118 <label for="<?php echo $size; ?>_crop"><?php _e('Crop image to exact dimensions'); ?></label> 119 </td> 120 </tr> 121 64 122 65 <?php do_settings_fields('media', 'default'); ?> 66 </table> 123 <?php 124 endforeach; 125 endif; //is_array($custom_sizes) 126 127 ?> 128 </table> 67 129 68 <h3><?php _e('Embeds') ?></h3> 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="" /> 69 136 70 <table class="form-table"> 137 </td> 138 </tr> 71 139 72 <tr valign="top">73 <th scope="row"><?php _e('oEmbed'); ?></th>74 <td><fieldset><legend class="screen-reader-text"><span><?php printf( __('Use <a href="%s">oEmbed</a> to assist in rich content embedding'), 'http://codex.wordpress.org/oEmbed' ); ?></span></legend>75 <label for="embed_useoembed"><input name="embed_useoembed" type="checkbox" id="embed_useoembed" value="1" <?php checked( '1', get_option('embed_useoembed') ); ?>/> <?php printf( __('Use <a href="%s">oEmbed</a> to assist in rich content embedding'), 'http://codex.wordpress.org/oEmbed' ); ?></label>76 </fieldset></td>77 </tr>78 140 79 <tr valign="top"> 80 <th scope="row"><?php _e('Auto-embeds'); ?></th> 81 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Attempt to automatically embed all plain text URLs'); ?></span></legend> 82 <label for="embed_autourls"><input name="embed_autourls" type="checkbox" id="embed_autourls" value="1" <?php checked( '1', get_option('embed_autourls') ); ?>/> <?php _e('Attempt to automatically embed all plain text URLs'); ?></label> 83 </fieldset></td> 84 </tr> 141 <?php do_settings_fields('media', 'default'); ?> 142 </table> 85 143 86 <tr valign="top"> 87 <th scope="row"><?php _e('Embed size') ?></th> 88 <td> 89 <label for="embed_size_w"><?php _e('Width'); ?></label> 90 <input name="embed_size_w" type="text" id="embed_size_w" value="<?php form_option('embed_size_w'); ?>" class="small-text" /> 91 <label for="embed_size_h"><?php _e('Height'); ?></label> 92 <input name="embed_size_h" type="text" id="embed_size_h" value="<?php form_option('embed_size_h'); ?>" class="small-text" /> 93 <?php if ( !empty($content_width) ) echo '<br />' . __("If the width value is left blank, embeds will default to the max width of your theme."); ?> 94 </td> 95 </tr> 144 <h3><?php _e('Embeds') ?></h3> 96 145 97 <?php do_settings_fields('media', 'embeds'); ?> 98 </table> 146 <table class="form-table"> 99 147 100 <?php do_settings_sections('media'); ?> 148 <tr valign="top"> 149 <th scope="row"><?php _e('oEmbed'); ?></th> 150 <td><fieldset><legend class="screen-reader-text"><span><?php printf( __('Use <a href="%s">oEmbed</a> to assist in rich content embedding'), 'http://codex.wordpress.org/oEmbed' ); ?></span></legend> 151 <label for="embed_useoembed"><input name="embed_useoembed" type="checkbox" id="embed_useoembed" value="1" <?php checked( '1', get_option('embed_useoembed') ); ?>/> <?php printf( __('Use <a href="%s">oEmbed</a> to assist in rich content embedding'), 'http://codex.wordpress.org/oEmbed' ); ?></label> 152 </fieldset></td> 153 </tr> 101 154 102 <p class="submit"> 103 <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" /> 104 </p> 155 <tr valign="top"> 156 <th scope="row"><?php _e('Auto-embeds'); ?></th> 157 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Attempt to automatically embed all plain text URLs'); ?></span></legend> 158 <label for="embed_autourls"><input name="embed_autourls" type="checkbox" id="embed_autourls" value="1" <?php checked( '1', get_option('embed_autourls') ); ?>/> <?php _e('Attempt to automatically embed all plain text URLs'); ?></label> 159 </fieldset></td> 160 </tr> 105 161 106 </form> 162 <tr valign="top"> 163 <th scope="row"><?php _e('Embed size') ?></th> 164 <td> 165 <label for="embed_size_w"><?php _e('Width'); ?></label> 166 <input name="embed_size_w" type="text" id="embed_size_w" value="<?php form_option('embed_size_w'); ?>" class="small-text" /> 167 <label for="embed_size_h"><?php _e('Height'); ?></label> 168 <input name="embed_size_h" type="text" id="embed_size_h" value="<?php form_option('embed_size_h'); ?>" class="small-text" /> 169 <?php if ( !empty($content_width) ) echo '<br />' . __("If the width value is left blank, embeds will default to the max width of your theme."); ?> 170 </td> 171 </tr> 107 172 173 <?php do_settings_fields('media', 'embeds'); ?> 174 </table> 175 176 <?php do_settings_sections('media'); ?> 177 178 <p class="submit"> 179 <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" /> 180 </p> 181 182 </form> 183 184 <h2><?php _e('Regenerate all thumbnails'); ?></h2> 185 186 <form method="post" action="<?php echo remove_query_arg('updated'); ?>"> 187 188 <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> 189 190 <p class="submit"> 191 <input type="submit" name="regen-thumbs" class="button-primary" value="<?php esc_attr_e('Regenerate all thumbnails') ?>" /> 192 </p> 193 194 </form> 195 196 197 <?php else : // not regenerating thumbs ?> 198 199 <h2><?php _e('Regenarating thumbnails'); ?></h2> 200 201 <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> 202 203 <?php 204 205 $attachments =& get_children( array( 206 'post_type' => 'attachment', 207 'post_mime_type' => 'image', 208 'numberposts' => -1, 209 'post_status' => null, 210 'post_parent' => null, // any parent 211 'output' => 'object', 212 ) ); 213 214 // Check for results 215 if ( FALSE === $attachments ) { 216 echo ' <p>' . __( "No images were found." ) . "</p>\n\n"; 217 } else { 218 $count = 0; 219 echo " <ol>\n"; 220 foreach ( $attachments as $attachment ) { 221 $lastImage = wp_update_image_thumbs($attachment->ID); 222 echo '<li>', $lastImage['file'], '</li>'; 223 $count ++; 224 ob_flush(); 225 flush(); 226 } 227 echo " </ol>\n\n"; 228 echo ' <p>' . sprintf( __( 'All done! Processed %d attachments.' ), $count ); 229 echo ' <a href="', admin_url(), 'options-media.php">', __('Go back'), '.</a>'; 230 echo "</p>\n\n"; 231 } 232 ?> 233 234 <?php endif; ?> 235 108 236 </div> 109 237 110 238 <?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', 'embed_useoembed', 'embed_autourls', 'embed_size_w', 'embed_size_h' ),28 'media' => array( 'image_default_size', 'image_default_align', 'image_default_link_type', 'embed_useoembed', 'embed_autourls', 'embed_size_w', 'embed_size_h' ), 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 8px 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 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:.2em;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:20%;text-align:center;}#media-upload th.actions-head{width:25%;text-align:center;}#media-upload a.wp-post-thumbnail{display:block;line-height:36px;float:right;margin-right:20px;}#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 8px 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 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:.2em;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:20%;text-align:center;}#media-upload th.actions-head{width:25%;text-align:center;}#media-upload a.wp-post-thumbnail{display:block;line-height:36px;float:right;margin-right:20px;}#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;} -
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,
