Ticket #8599: multiple_custom_image_sizes.patch
| File multiple_custom_image_sizes.patch, 26.8 KB (added by leogermani, 4 years ago) |
|---|
-
wp-includes/post.php
2689 2689 } 2690 2690 2691 2691 // remove intermediate images if there are any 2692 $sizes = apply_filters('intermediate_image_sizes', array('thumbnail', 'medium', 'large'));2692 $sizes = get_intermediate_sizes(); 2693 2693 foreach ( $sizes as $size ) { 2694 2694 if ( $intermediate = image_get_intermediate_size($postid, $size) ) { 2695 2695 $intermediate_file = apply_filters('wp_delete_file', $intermediate['path']); -
wp-includes/media.php
492 492 } 493 493 494 494 /** 495 * Get the available image sizes 496 * @since 2.9 497 * @return array Returns a filtered array of image size strings 498 */ 499 function get_intermediate_sizes($unfiltered = false) 500 { 501 $core = get_core_intermediate_sizes(true); 502 $custom = get_custom_intermediate_sizes(true); 503 504 $intermediate_sizes = array_merge($core, $custom); 505 506 if (!$unfiltered) 507 $intermediate_sizes = apply_filters('intermediate_image_sizes', $intermediate_sizes); 508 return $intermediate_sizes; 509 } 510 511 /** 512 * Get the core image sizes 513 * @since 2.9 514 * @return array Returns a filtered array of image size strings 515 */ 516 function get_core_intermediate_sizes($unfiltered = false) 517 { 518 $intermediate_sizes = array(__('Thumbnail') => 'thumbnail', __('Medium') => 'medium', __('Large') => 'large'); 519 if (!$unfiltered) 520 $intermediate_sizes = apply_filters('intermediate_image_sizes', $intermediate_sizes); 521 return $intermediate_sizes; 522 } 523 524 /** 525 * Get the custom image sizes 526 * @since 2.9 527 * @return array Returns a filtered array of image size strings 528 */ 529 function get_custom_intermediate_sizes($unfiltered = false) 530 { 531 $intermediate_sizes = array(); 532 $custom_sizes = get_option('custom_image_sizes'); 533 if (is_array($custom_sizes)) { 534 foreach ($custom_sizes as $size) { 535 $intermediate_sizes[$size] = sanitize_title_with_dashes($size); 536 } 537 } 538 539 if (!$unfiltered) 540 $intermediate_sizes = apply_filters('intermediate_image_sizes', $intermediate_sizes); 541 return $intermediate_sizes; 542 } 543 544 545 /** 495 546 * Retrieve an image to represent an attachment. 496 547 * 497 548 * A mime icon for files, thumbnail or intermediate size for images. -
wp-admin/admin-ajax.php
1335 1335 1336 1336 die(); 1337 1337 break; 1338 case 'custom-image-size-add' : 1339 1340 if (isset($_POST['new_size_name'])) { 1341 $custom_sizes = get_option('custom_image_sizes'); 1342 $name = $_POST['new_size_name']; 1343 $slug = sanitize_title_with_dashes($name); 1344 $protected_names = array('Full size', 'Thumbnail', 'Medium', 'Large'); 1345 1346 if (is_array($custom_sizes)) { 1347 1348 // check for duplicates 1349 if ( in_array($name, $custom_sizes) ) { 1350 $suffix = 2; 1351 do { 1352 $alt_name = substr($name, 0, 200-(strlen($suffix)+1)). "-$suffix"; 1353 $check_name = in_array($alt_name, $custom_sizes); 1354 $suffix++; 1355 } while ($check_name); 1356 $name = $alt_name; 1357 $slug = sanitize_title_with_dashes($name); 1358 } 1359 array_push($custom_sizes, $name); 1360 } else { 1361 $custom_sizes = array($name); 1362 } 1363 1364 if (!in_array($name, $protected_names) && update_option('custom_image_sizes', $custom_sizes)) { 1365 $op = '<tr valign="top"> 1366 <th scope="row"> 1367 <span class="size_name"> 1368 ' . $name . ' 1369 </span> 1370 <p style="margin: 0;"> 1371 <a style="display: none; cursor: pointer;" class="remove_custom_size delete"> 1372 ' . __('Remove') . ' 1373 </a> 1374 </p> 1375 </th> 1376 <td> 1377 <label for="' . $slug . '_size_w">' . __('Max Width') . '</label> 1378 <input name="' . $slug . '_size_w" type="text" id="' . $slug . '_size_w" value="" class="small-text" /> 1379 <label for="' . $slug . '_size_h">' . __('Max Height') . '</label> 1380 <input name="' . $slug . '_size_h" type="text" id="' . $slug . '_size_h" value="" class="small-text" /><br /> 1381 <input name="' . $slug . '_crop" type="checkbox" id="' . $slug . '_crop" value="1" /> 1382 <label for="' . $slug . '_crop">' . __('Crop image to exact dimensions') . '</label> 1383 </td> 1384 </tr>'; 1385 1386 echo $op; 1387 } 1388 1389 } 1390 1391 break; 1392 1393 case 'custom-image-size-remove' : 1394 1395 $custom_sizes = get_option('custom_image_sizes'); 1396 $name = $_POST['size_name']; 1397 1398 if (is_array($custom_sizes)) { 1399 $key = array_search($name, $custom_sizes); 1400 array_splice($custom_sizes, $key, 1); 1401 1402 $slug = sanitize_title_with_dashes($name); 1403 delete_option($slug . '_size_w'); 1404 delete_option($slug . '_size_h'); 1405 delete_option($slug . '_crop'); 1406 1407 update_option('custom_image_sizes', $custom_sizes); 1408 echo 'ok'; 1409 } 1410 1411 1412 1413 break; 1414 1338 1415 default : 1339 1416 do_action( 'wp_ajax_' . $_POST['action'] ); 1340 1417 die('0'); -
wp-admin/includes/media.php
789 789 function image_size_input_fields( $post, $checked = '' ) { 790 790 791 791 // get a list of the actual pixel dimensions of each possible intermediate version of this image 792 $size_names = array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full size')); 792 $size_names = get_intermediate_sizes(); 793 $size_names[__('Full size')] = 'full'; 793 794 794 foreach ( $size_names as $ size => $name ) {795 foreach ( $size_names as $name => $size ) { 795 796 $downsize = image_downsize($post->ID, $size); 796 797 797 798 // 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") ); -
wp-admin/js/options-media.js
1 jQuery(document).ready(function($) { 2 3 $('#add_new_size').click(function() { 4 addNewSize(); 5 }); 6 7 $('#new_size').keypress(function(e) { 8 if (13 == e.keyCode){ 9 addNewSize(); 10 return false; 11 } 12 }); 13 14 $('#image_sizes_table').find('tr').mouseover(function() { 15 new_size_over($(this)) 16 }).mouseout(function() { 17 new_size_out($(this)); 18 }).find('.remove_custom_size').click(function() { 19 remove_custom_size($(this)); 20 }); 21 22 function new_size_over(tr) { 23 tr.find('.remove_custom_size').show(); 24 } 25 26 function new_size_out(tr) { 27 tr.find('.remove_custom_size').hide(); 28 } 29 30 function remove_custom_size(button) { 31 if (confirm(messages.confirm_remove)) { 32 var name = button.parents('th').find('span.size_name').html(); 33 del_size = $.ajax({ 34 type: 'POST', 35 url: ajaxurl, 36 dataType: 'html', 37 data: { 38 size_name: name, 39 action: 'custom-image-size-remove' 40 }, 41 42 complete: function() { 43 if (del_size.responseText == 'ok') { 44 button.parents('tr').animate({backgroundColor: "#bf5e5e"}, 300).animate({opacity: "hide"}, 1000, "", function(){ 45 $(this).remove(); 46 }); 47 } else 48 alert(messages.error_remove); 49 } 50 }); 51 } 52 } 53 54 function addNewSize() { 55 56 var sizeName = $('#new_size').val(); 57 if (!sizeName) { 58 alert(messages.error_add_blank); 59 return; 60 } 61 new_size = $.ajax({ 62 type: 'POST', 63 url: ajaxurl, 64 dataType: 'html', 65 data: { 66 new_size_name: sizeName, 67 action: 'custom-image-size-add' 68 }, 69 70 complete: function() { 71 if (new_size.responseText) { 72 $('#image_sizes_table').append(new_size.responseText).find('tr:last').css('background-color', '#F9F9F9').animate({backgroundColor: "#FFFFE0"}, 400).animate({backgroundColor: "#F9F9F9"}, 1000).mouseover(function() { 73 new_size_over($(this)); 74 }).mouseout(function() { 75 new_size_out($(this)); 76 }).find('.remove_custom_size').click(function() { 77 remove_custom_size($(this)); 78 }); 79 } else { 80 alert(messages.error_add); 81 } 82 } 83 }); 84 85 } 86 87 88 }); -
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 )); 19 12 20 if ( ! current_user_can('manage_options') ) 13 21 wp_die(__('You do not have sufficient permissions to manage options for this blog.')); 14 22 … … 29 37 <h3><?php _e('Image sizes') ?></h3> 30 38 <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 39 32 <table class="form-table" >40 <table class="form-table" id="image_sizes_table"> 33 41 <tr valign="top"> 34 42 <th scope="row"><?php _e('Thumbnail size') ?></th> 35 43 <td> … … 62 70 </fieldset></td> 63 71 </tr> 64 72 73 <?php 74 75 $custom_sizes = get_custom_intermediate_sizes(); 76 77 if (is_array($custom_sizes)) : 78 foreach ($custom_sizes as $name => $size) : 79 ?> 80 <tr valign="top"> 81 <th scope="row"> 82 <span class="size_name"><?php echo $name; ?></span> 83 <p style="margin: 0;"> 84 <a style="display: none; cursor: pointer;" class="remove_custom_size delete"> 85 <?php _e('Remove'); ?> 86 </a> 87 </p> 88 </th> 89 <td> 90 <label for="<?php echo $size; ?>_size_w"><?php _e('Max Width'); ?></label> 91 <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" /> 92 <label for="<?php echo $size; ?>_size_h"><?php _e('Max Height'); ?></label> 93 <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 /> 94 <input name="<?php echo $size; ?>_crop" type="checkbox" id="<?php echo $size; ?>_crop" value="1" <?php checked('1', get_option($size . '_crop')); ?>/> 95 <label for="<?php echo $size; ?>_crop"><?php _e('Crop image to exact dimensions'); ?></label> 96 </td> 97 </tr> 98 99 <?php 100 endforeach; 101 endif; //is_array($custom_sizes) 102 103 ?> 104 </table> 105 106 <table class="form-table"> 107 <tr valign="top"> 108 <th scope="row"><?php _e('Add new') ?></th> 109 <td> 110 <label for="new_size"><?php _e('New size name'); ?></label> 111 <input name="new_size" type="text" id="new_size" value="" /> 112 <a style="cursor: pointer;" id="add_new_size"><?php _e('Add') ?></a> 113 </td> 114 </tr> 115 116 65 117 <?php do_settings_fields('media', 'default'); ?> 66 118 </table> 67 119 120 68 121 <?php do_settings_sections('media'); ?> 69 122 70 123 <p class="submit"> -
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 #array_merge($whitelist_options['media'], $custom_image_sizes); 45 36 46 $whitelist_options = apply_filters( 'whitelist_options', $whitelist_options ); 37 47 38 48 if ( !current_user_can('manage_options') ) -
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, -
wp-admin/js/options-media.js
1 jQuery(document).ready(function($) { 2 3 $('#add_new_size').click(function() { 4 addNewSize(); 5 }); 6 7 $('#new_size').keypress(function(e) { 8 if (13 == e.keyCode){ 9 addNewSize(); 10 return false; 11 } 12 }); 13 14 $('#image_sizes_table').find('tr').mouseover(function() { 15 new_size_over($(this)) 16 }).mouseout(function() { 17 new_size_out($(this)); 18 }).find('.remove_custom_size').click(function() { 19 remove_custom_size($(this)); 20 }); 21 22 function new_size_over(tr) { 23 tr.find('.remove_custom_size').show(); 24 } 25 26 function new_size_out(tr) { 27 tr.find('.remove_custom_size').hide(); 28 } 29 30 function remove_custom_size(button) { 31 if (confirm(messages.confirm_remove)) { 32 var name = button.parents('th').find('span.size_name').html(); 33 del_size = $.ajax({ 34 type: 'POST', 35 url: ajaxurl, 36 dataType: 'html', 37 data: { 38 size_name: name, 39 action: 'custom-image-size-remove' 40 }, 41 42 complete: function() { 43 if (del_size.responseText == 'ok') { 44 button.parents('tr').animate({backgroundColor: "#bf5e5e"}, 300).animate({opacity: "hide"}, 1000, "", function(){ 45 $(this).remove(); 46 }); 47 } else 48 alert(messages.error_remove); 49 } 50 }); 51 } 52 } 53 54 function addNewSize() { 55 56 var sizeName = $('#new_size').val(); 57 if (!sizeName) { 58 alert(messages.error_add_blank); 59 return; 60 } 61 new_size = $.ajax({ 62 type: 'POST', 63 url: ajaxurl, 64 dataType: 'html', 65 data: { 66 new_size_name: sizeName, 67 action: 'custom-image-size-add' 68 }, 69 70 complete: function() { 71 if (new_size.responseText) { 72 $('#image_sizes_table').append(new_size.responseText).find('tr:last').css('background-color', '#F9F9F9').animate({backgroundColor: "#FFFFE0"}, 400).animate({backgroundColor: "#F9F9F9"}, 1000).mouseover(function() { 73 new_size_over($(this)); 74 }).mouseout(function() { 75 new_size_out($(this)); 76 }).find('.remove_custom_size').click(function() { 77 remove_custom_size($(this)); 78 }); 79 } else { 80 alert(messages.error_add); 81 } 82 } 83 }); 84 85 } 86 87 88 });
