Ticket #34196: 34196.1.patch
File 34196.1.patch, 16.6 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/schema.php
506 506 // 4.3.0 507 507 'finished_splitting_shared_terms' => 1, 508 508 'site_icon' => 0, 509 510 // 4.4.0 511 'medium_large_size_w' => 768, 512 'medium_large_size_h' => 0, 509 513 ); 510 514 511 515 // 3.3 -
src/wp-admin/options.php
84 84 $whitelist_options = array( 85 85 'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'timezone_string', 'WPLANG' ), 86 86 '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' ), 87 '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' ),87 'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'medium_large_size_w', 'medium_large_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ), 88 88 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public' ), 89 89 'writing' => array( 'default_category', 'default_email_category', 'default_link_category', 'default_post_format' ) 90 90 ); -
src/wp-includes/class-wp-image-editor-gd.php
212 212 * @access public 213 213 * 214 214 * @param array $sizes { 215 * An array of image size arrays. Default sizes are 'small', 'medium', ' large'.215 * An array of image size arrays. Default sizes are 'small', 'medium', 'medium_large', 'large'. 216 216 * 217 217 * Either a height or width must be provided. 218 218 * If one of the two is set to null, the resize will -
src/wp-includes/class-wp-image-editor-imagick.php
270 270 * @access public 271 271 * 272 272 * @param array $sizes { 273 * An array of image size arrays. Default sizes are 'small', 'medium', ' large'.273 * An array of image size arrays. Default sizes are 'small', 'medium', 'medium_large', 'large'. 274 274 * 275 275 * Either a height or width must be provided. 276 276 * If one of the two is set to null, the resize will -
src/wp-includes/class-wp-xmlrpc-server.php
513 513 'readonly' => false, 514 514 'option' => 'medium_size_h' 515 515 ), 516 'medium_large_size_w' => array( 517 'desc' => __( 'Medium-Large size image width' ), 518 'readonly' => false, 519 'option' => 'medium_large_size_w' 520 ), 521 'medium_large_size_h' => array( 522 'desc' => __( 'Medium-Large size image height' ), 523 'readonly' => false, 524 'option' => 'medium_large_size_h' 525 ), 516 526 'large_size_w' => array( 517 527 'desc' => __( 'Large size image width' ), 518 528 'readonly' => false, -
src/wp-includes/formatting.php
3662 3662 case 'thumbnail_size_h': 3663 3663 case 'medium_size_w': 3664 3664 case 'medium_size_h': 3665 case 'medium_large_size_w': 3666 case 'medium_large_size_h': 3665 3667 case 'large_size_w': 3666 3668 case 'large_size_h': 3667 3669 case 'mailserver_port': -
src/wp-includes/media.php
14 14 * The `$size` parameter accepts either an array or a string. The supported string 15 15 * values are 'thumb' or 'thumbnail' for the given thumbnail size or defaults at 16 16 * 128 width and 96 height in pixels. Also supported for the string value is 17 * 'medium' and 'full'. The 'full' isn't actually supported, but any value other17 * 'medium', 'medium_large' and 'full'. The 'full' isn't actually supported, but any value other 18 18 * than the supported will result in the content_width size or 500 if that is 19 19 * not set. 20 20 * … … 60 60 elseif ( $size == 'medium' ) { 61 61 $max_width = intval(get_option('medium_size_w')); 62 62 $max_height = intval(get_option('medium_size_h')); 63 // if no width is set, default to the theme content width if available 63 64 64 } 65 elseif ( $size == 'medium_large' ) { 66 $max_width = intval(get_option('medium_large_size_w')); 67 $max_height = intval(get_option('medium_large_size_h')); 68 69 if ( intval($content_width) > 0 ) { 70 $max_width = min( intval($content_width), $max_width ); 71 } 72 } 65 73 elseif ( $size == 'large' ) { 66 74 /* 67 75 * We're inserting a large size image into the editor. If it's a really … … 71 79 */ 72 80 $max_width = intval(get_option('large_size_w')); 73 81 $max_height = intval(get_option('large_size_h')); 74 if ( intval($content_width) > 0 ) 82 if ( intval($content_width) > 0 ) { 75 83 $max_width = min( intval($content_width), $max_width ); 84 } 76 85 } elseif ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ) ) ) { 77 86 $max_width = intval( $_wp_additional_image_sizes[$size]['width'] ); 78 87 $max_height = intval( $_wp_additional_image_sizes[$size]['height'] ); … … 706 715 */ 707 716 function get_intermediate_image_sizes() { 708 717 global $_wp_additional_image_sizes; 709 $image_sizes = array('thumbnail', 'medium', ' large'); // Standard sizes718 $image_sizes = array('thumbnail', 'medium', 'medium_large', 'large'); // Standard sizes 710 719 if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) ) 711 720 $image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) ); 712 721 … … 716 725 * @since 2.5.0 717 726 * 718 727 * @param array $image_sizes An array of intermediate image sizes. Defaults 719 * are 'thumbnail', 'medium', ' large'.728 * are 'thumbnail', 'medium', 'medium_large', 'large'. 720 729 */ 721 730 return apply_filters( 'intermediate_image_sizes', $image_sizes ); 722 731 } -
src/wp-includes/version.php
11 11 * 12 12 * @global int $wp_db_version 13 13 */ 14 $wp_db_version = 35 329;14 $wp_db_version = 35465; 15 15 16 16 /** 17 17 * Holds the TinyMCE version -
tests/phpunit/tests/media.php
724 724 return array( 150, 150 ); 725 725 case 'medium': 726 726 return array( 300, 225 ); 727 case 'medium_large': 728 return array( 768, 576 ); 727 729 case 'large': 728 730 return array( 1024, 768 ); 729 731 case 'full': … … 742 744 $uploads_dir_url = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/'; 743 745 744 746 $expected = $uploads_dir_url . $year_month . '/' . $image_meta['sizes']['medium']['file'] . ' ' . $image_meta['sizes']['medium']['width'] . 'w, ' . 747 $uploads_dir_url . $year_month . '/' . $image_meta['sizes']['medium_large']['file'] . ' ' . $image_meta['sizes']['medium_large']['width'] . 'w, ' . 745 748 $uploads_dir_url . $year_month . '/' . $image_meta['sizes']['large']['file'] . ' ' . $image_meta['sizes']['large']['width'] . 'w, ' . 746 749 $uploads_dir_url . $image_meta['file'] . ' ' . $image_meta['width'] . 'w'; 747 750 748 751 // Set up test cases for all expected size names and a random one. 749 $sizes = array( 'medium', ' large', 'full', 'yoav' );752 $sizes = array( 'medium', 'medium_large', 'large', 'full', 'yoav' ); 750 753 751 754 foreach ( $sizes as $size ) { 752 755 $image_url = wp_get_attachment_image_url( self::$large_id, $size ); … … 773 776 $uploads_dir_url = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/'; 774 777 775 778 $expected = $uploads_dir_url . $image_meta['sizes']['medium']['file'] . ' ' . $image_meta['sizes']['medium']['width'] . 'w, ' . 779 $uploads_dir_url . $image_meta['sizes']['medium_large']['file'] . ' ' . $image_meta['sizes']['medium_large']['width'] . 'w, ' . 776 780 $uploads_dir_url . $image_meta['sizes']['large']['file'] . ' ' . $image_meta['sizes']['large']['width'] . 'w, ' . 777 781 $uploads_dir_url . $image_meta['file'] . ' ' . $image_meta['width'] . 'w'; 778 782 779 783 // Set up test cases for all expected size names and a random one. 780 $sizes = array( 'medium', ' large', 'full', 'yoav' );784 $sizes = array( 'medium', 'medium_large', 'large', 'full', 'yoav' ); 781 785 782 786 foreach ( $sizes as $size ) { 783 787 $size_array = $this->_get_image_size_array_from_name( $size ); … … 806 810 $filename_base = basename( $image_meta['file'], '.png' ); 807 811 $image_meta['file'] = str_replace( $filename_base, $filename_base . '-' . $hash, $image_meta['file'] ); 808 812 $image_meta['sizes']['medium']['file'] = str_replace( $filename_base, $filename_base . '-' . $hash, $image_meta['sizes']['medium']['file'] ); 813 $image_meta['sizes']['medium_large']['file'] = str_replace( $filename_base, $filename_base . '-' . $hash, $image_meta['sizes']['medium_large']['file'] ); 809 814 $image_meta['sizes']['large']['file'] = str_replace( $filename_base, $filename_base . '-' . $hash, $image_meta['sizes']['large']['file'] ); 810 815 811 816 // Calculate a srcset array. … … 857 862 $expected = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $year_month = date('Y/m') . '/' 858 863 . $image_meta['sizes']['medium']['file'] . ' ' . $image_meta['sizes']['medium']['width'] . 'w, '; 859 864 $expected .= 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $year_month = date('Y/m') . '/' 865 . $image_meta['sizes']['medium_large']['file'] . ' ' . $image_meta['sizes']['medium_large']['width'] . 'w, '; 866 $expected .= 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $year_month = date('Y/m') . '/' 860 867 . $image_meta['sizes']['large']['file'] . ' ' . $image_meta['sizes']['large']['width'] . 'w, '; 861 868 $expected .= 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_meta['file'] . ' ' . $image_meta['width'] .'w'; 862 869 … … 883 890 */ 884 891 function test_wp_get_attachment_image_sizes() { 885 892 // Test sizes against the default WP sizes. 886 $intermediates = array( 'thumbnail', 'medium', 'large');893 $intermediates = array('thumbnail', 'medium', 'medium_large', 'large'); 887 894 $image_meta = wp_get_attachment_metadata( self::$large_id ); 888 895 889 896 foreach( $intermediates as $int_size ) { -
tests/phpunit/tests/post/attachments.php
35 35 // intermediate copies should not exist 36 36 $this->assertFalse( image_get_intermediate_size($id, 'thumbnail') ); 37 37 $this->assertFalse( image_get_intermediate_size($id, 'medium') ); 38 $this->assertFalse( image_get_intermediate_size($id, 'medium_large') ); 38 39 39 // medium and full size will both point to the original40 // medium, medium_large, and full size will both point to the original 40 41 $downsize = image_downsize($id, 'medium'); 41 42 $this->assertEquals( basename( $upload['file'] ), basename($downsize[0]) ); 42 43 $this->assertEquals( 50, $downsize[1] ); 43 44 $this->assertEquals( 50, $downsize[2] ); 44 45 46 $downsize = image_downsize($id, 'medium_large'); 47 $this->assertEquals( basename( $upload['file'] ), basename($downsize[0]) ); 48 $this->assertEquals( 50, $downsize[1] ); 49 $this->assertEquals( 50, $downsize[2] ); 50 45 51 $downsize = image_downsize($id, 'full'); 46 52 $this->assertEquals( basename( $upload['file'] ), basename($downsize[0]) ); 47 53 $this->assertEquals( 50, $downsize[1] ); … … 72 78 $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path']) ); 73 79 74 80 $this->assertFalse( image_get_intermediate_size($id, 'medium') ); 81 $this->assertFalse( image_get_intermediate_size($id, 'medium_large') ); 75 82 76 83 // the thumb url should point to the thumbnail intermediate 77 84 $this->assertEquals( $thumb['url'], wp_get_attachment_thumb_url($id) ); … … 82 89 $this->assertEquals( 150, $downsize[1] ); 83 90 $this->assertEquals( 150, $downsize[2] ); 84 91 85 // medium and full will both point to the original92 // medium, medium_large, and full will both point to the original 86 93 $downsize = image_downsize($id, 'medium'); 87 94 $this->assertEquals( 'a2-small.jpg', basename($downsize[0]) ); 88 95 $this->assertEquals( 400, $downsize[1] ); 89 96 $this->assertEquals( 300, $downsize[2] ); 90 97 98 $downsize = image_downsize($id, 'medium_large'); 99 $this->assertEquals( 'a2-small.jpg', basename($downsize[0]) ); 100 $this->assertEquals( 400, $downsize[1] ); 101 $this->assertEquals( 300, $downsize[2] ); 102 91 103 $downsize = image_downsize($id, 'full'); 92 104 $this->assertEquals( 'a2-small.jpg', basename($downsize[0]) ); 93 105 $this->assertEquals( 400, $downsize[1] ); … … 95 107 96 108 } 97 109 98 function test_insert_image_medium () {110 function test_insert_image_medium_sizes() { 99 111 if ( !function_exists( 'imagejpeg' ) ) 100 112 $this->markTestSkipped( 'jpeg support unavailable' ); 101 113 … … 102 114 update_option('medium_size_w', 400); 103 115 update_option('medium_size_h', 0); 104 116 117 update_option('medium_large_size_w', 600); 118 update_option('medium_large_size_h', 0); 119 105 120 $filename = ( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG' ); 106 121 $contents = file_get_contents($filename); 107 122 … … 120 135 $this->assertEquals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] ); 121 136 $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path']) ); 122 137 138 $medium_large = image_get_intermediate_size($id, 'medium_large'); 139 $this->assertEquals( '2007-06-17DSC_4173-600x904.jpg', $medium_large['file'] ); 140 $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium_large['path']) ); 141 123 142 // the thumb url should point to the thumbnail intermediate 124 143 $this->assertEquals( $thumb['url'], wp_get_attachment_thumb_url($id) ); 125 144 … … 134 153 $this->assertEquals( 400, $downsize[1] ); 135 154 $this->assertEquals( 602, $downsize[2] ); 136 155 156 $downsize = image_downsize($id, 'medium_large'); 157 $this->assertEquals( '2007-06-17DSC_4173-600x904.jpg', basename($downsize[0]) ); 158 $this->assertEquals( 600, $downsize[1] ); 159 $this->assertEquals( 904, $downsize[2] ); 160 137 161 $downsize = image_downsize($id, 'full'); 138 162 $this->assertEquals( '2007-06-17DSC_4173.jpg', basename($downsize[0]) ); 139 163 $this->assertEquals( 680, $downsize[1] ); … … 148 172 update_option('medium_size_w', 400); 149 173 update_option('medium_size_h', 0); 150 174 175 update_option('medium_large_size_w', 600); 176 update_option('medium_large_size_h', 0); 177 151 178 $filename = ( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG' ); 152 179 $contents = file_get_contents($filename); 153 180 … … 166 193 $this->assertEquals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] ); 167 194 $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path']) ); 168 195 196 $medium_large = image_get_intermediate_size($id, 'medium_large'); 197 $this->assertEquals( '2007-06-17DSC_4173-600x904.jpg', $medium_large['file'] ); 198 $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium_large['path']) ); 199 169 200 $meta = wp_get_attachment_metadata($id); 170 201 $original = $meta['file']; 171 202 $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $original) ); … … 175 206 176 207 $this->assertFalse( is_file($thumb['path']) ); 177 208 $this->assertFalse( is_file($medium['path']) ); 209 $this->assertFalse( is_file($medium_large['path']) ); 178 210 $this->assertFalse( is_file($original) ); 179 211 } 180 212