<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[35479] trunk: Media: add a new image size, `medium_large`.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/35479">35479</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/35479","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>wonderboymusic</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2015-10-31 20:49:26 +0000 (Sat, 31 Oct 2015)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Media: add a new image size, `medium_large`. Bumps db version to add new options.
Adds unit tests.
Props DH-Shredder, joemcgill, azaozz.
Fixes <a href="https://core.trac.wordpress.org/ticket/34196">#34196</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesschemaphp">trunk/src/wp-admin/includes/schema.php</a></li>
<li><a href="#trunksrcwpadminoptionsphp">trunk/src/wp-admin/options.php</a></li>
<li><a href="#trunksrcwpincludesclasswpimageeditorgdphp">trunk/src/wp-includes/class-wp-image-editor-gd.php</a></li>
<li><a href="#trunksrcwpincludesclasswpimageeditorimagickphp">trunk/src/wp-includes/class-wp-image-editor-imagick.php</a></li>
<li><a href="#trunksrcwpincludesclasswpxmlrpcserverphp">trunk/src/wp-includes/class-wp-xmlrpc-server.php</a></li>
<li><a href="#trunksrcwpincludesformattingphp">trunk/src/wp-includes/formatting.php</a></li>
<li><a href="#trunksrcwpincludesmediaphp">trunk/src/wp-includes/media.php</a></li>
<li><a href="#trunksrcwpincludesversionphp">trunk/src/wp-includes/version.php</a></li>
<li><a href="#trunktestsphpunittestsmediaphp">trunk/tests/phpunit/tests/media.php</a></li>
<li><a href="#trunktestsphpunittestspostattachmentsphp">trunk/tests/phpunit/tests/post/attachments.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesschemaphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/schema.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/schema.php 2015-10-31 20:38:07 UTC (rev 35478)
+++ trunk/src/wp-admin/includes/schema.php 2015-10-31 20:49:26 UTC (rev 35479)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -506,6 +506,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // 4.3.0
</span><span class="cx" style="display: block; padding: 0 10px"> 'finished_splitting_shared_terms' => 1,
</span><span class="cx" style="display: block; padding: 0 10px"> 'site_icon' => 0,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // 4.4.0
+ 'medium_large_size_w' => 768,
+ 'medium_large_size_h' => 0,
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // 3.3
</span></span></pre></div>
<a id="trunksrcwpadminoptionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/options.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/options.php 2015-10-31 20:38:07 UTC (rev 35478)
+++ trunk/src/wp-admin/options.php 2015-10-31 20:49:26 UTC (rev 35479)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -84,7 +84,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $whitelist_options = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'timezone_string', 'WPLANG' ),
</span><span class="cx" style="display: block; padding: 0 10px"> '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' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- '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' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ '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' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'writing' => array( 'default_category', 'default_email_category', 'default_link_category', 'default_post_format' )
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpimageeditorgdphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-image-editor-gd.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-image-editor-gd.php 2015-10-31 20:38:07 UTC (rev 35478)
+++ trunk/src/wp-includes/class-wp-image-editor-gd.php 2015-10-31 20:49:26 UTC (rev 35479)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -212,7 +212,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @access public
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $sizes {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * An array of image size arrays. Default sizes are 'small', 'medium', 'large'.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * An array of image size arrays. Default sizes are 'small', 'medium', 'medium_large', 'large'.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Either a height or width must be provided.
</span><span class="cx" style="display: block; padding: 0 10px"> * If one of the two is set to null, the resize will
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpimageeditorimagickphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-image-editor-imagick.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-image-editor-imagick.php 2015-10-31 20:38:07 UTC (rev 35478)
+++ trunk/src/wp-includes/class-wp-image-editor-imagick.php 2015-10-31 20:49:26 UTC (rev 35479)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -270,7 +270,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @access public
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $sizes {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * An array of image size arrays. Default sizes are 'small', 'medium', 'large'.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * An array of image size arrays. Default sizes are 'small', 'medium', 'medium_large', 'large'.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Either a height or width must be provided.
</span><span class="cx" style="display: block; padding: 0 10px"> * If one of the two is set to null, the resize will
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpxmlrpcserverphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-xmlrpc-server.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-xmlrpc-server.php 2015-10-31 20:38:07 UTC (rev 35478)
+++ trunk/src/wp-includes/class-wp-xmlrpc-server.php 2015-10-31 20:49:26 UTC (rev 35479)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -513,6 +513,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'readonly' => false,
</span><span class="cx" style="display: block; padding: 0 10px"> 'option' => 'medium_size_h'
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'medium_large_size_w' => array(
+ 'desc' => __( 'Medium-Large size image width' ),
+ 'readonly' => false,
+ 'option' => 'medium_large_size_w'
+ ),
+ 'medium_large_size_h' => array(
+ 'desc' => __( 'Medium-Large size image height' ),
+ 'readonly' => false,
+ 'option' => 'medium_large_size_h'
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'large_size_w' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'desc' => __( 'Large size image width' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'readonly' => false,
</span></span></pre></div>
<a id="trunksrcwpincludesformattingphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/formatting.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/formatting.php 2015-10-31 20:38:07 UTC (rev 35478)
+++ trunk/src/wp-includes/formatting.php 2015-10-31 20:49:26 UTC (rev 35479)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3662,6 +3662,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> case 'thumbnail_size_h':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'medium_size_w':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'medium_size_h':
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'medium_large_size_w':
+ case 'medium_large_size_h':
</ins><span class="cx" style="display: block; padding: 0 10px"> case 'large_size_w':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'large_size_h':
</span><span class="cx" style="display: block; padding: 0 10px"> case 'mailserver_port':
</span></span></pre></div>
<a id="trunksrcwpincludesmediaphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/media.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/media.php 2015-10-31 20:38:07 UTC (rev 35478)
+++ trunk/src/wp-includes/media.php 2015-10-31 20:49:26 UTC (rev 35479)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,7 +14,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * The `$size` parameter accepts either an array or a string. The supported string
</span><span class="cx" style="display: block; padding: 0 10px"> * values are 'thumb' or 'thumbnail' for the given thumbnail size or defaults at
</span><span class="cx" style="display: block; padding: 0 10px"> * 128 width and 96 height in pixels. Also supported for the string value is
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * 'medium' and 'full'. The 'full' isn't actually supported, but any value other
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * 'medium', 'medium_large' and 'full'. The 'full' isn't actually supported, but any value other
</ins><span class="cx" style="display: block; padding: 0 10px"> * than the supported will result in the content_width size or 500 if that is
</span><span class="cx" style="display: block; padding: 0 10px"> * not set.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -60,8 +60,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> elseif ( $size == 'medium' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $max_width = intval(get_option('medium_size_w'));
</span><span class="cx" style="display: block; padding: 0 10px"> $max_height = intval(get_option('medium_size_h'));
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // if no width is set, default to the theme content width if available
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ elseif ( $size == 'medium_large' ) {
+ $max_width = intval( get_option( 'medium_large_size_w' ) );
+ $max_height = intval( get_option( 'medium_large_size_h' ) );
+
+ if ( intval( $content_width ) > 0 ) {
+ $max_width = min( intval( $content_width ), $max_width );
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> elseif ( $size == 'large' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px"> * We're inserting a large size image into the editor. If it's a really
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -71,8 +79,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $max_width = intval(get_option('large_size_w'));
</span><span class="cx" style="display: block; padding: 0 10px"> $max_height = intval(get_option('large_size_h'));
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( intval($content_width) > 0 )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( intval($content_width) > 0 ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $max_width = min( intval($content_width), $max_width );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> } elseif ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ) ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $max_width = intval( $_wp_additional_image_sizes[$size]['width'] );
</span><span class="cx" style="display: block; padding: 0 10px"> $max_height = intval( $_wp_additional_image_sizes[$size]['height'] );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -706,7 +715,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function get_intermediate_image_sizes() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $_wp_additional_image_sizes;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $image_sizes = array('thumbnail', 'medium', 'large'); // Standard sizes
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $image_sizes = array('thumbnail', 'medium', 'medium_large', 'large'); // Standard sizes
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )
</span><span class="cx" style="display: block; padding: 0 10px"> $image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -716,7 +725,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $image_sizes An array of intermediate image sizes. Defaults
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * are 'thumbnail', 'medium', 'large'.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * are 'thumbnail', 'medium', 'medium_large', 'large'.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> return apply_filters( 'intermediate_image_sizes', $image_sizes );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludesversionphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/version.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/version.php 2015-10-31 20:38:07 UTC (rev 35478)
+++ trunk/src/wp-includes/version.php 2015-10-31 20:49:26 UTC (rev 35479)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -11,7 +11,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global int $wp_db_version
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-$wp_db_version = 35329;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+$wp_db_version = 35465;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Holds the TinyMCE version
</span></span></pre></div>
<a id="trunktestsphpunittestsmediaphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/media.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/media.php 2015-10-31 20:38:07 UTC (rev 35478)
+++ trunk/tests/phpunit/tests/media.php 2015-10-31 20:49:26 UTC (rev 35479)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -724,6 +724,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return array( 150, 150 );
</span><span class="cx" style="display: block; padding: 0 10px"> case 'medium':
</span><span class="cx" style="display: block; padding: 0 10px"> return array( 300, 225 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ case 'medium_large':
+ return array( 768, 576 );
</ins><span class="cx" style="display: block; padding: 0 10px"> case 'large':
</span><span class="cx" style="display: block; padding: 0 10px"> return array( 1024, 768 );
</span><span class="cx" style="display: block; padding: 0 10px"> case 'full':
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -742,11 +744,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $uploads_dir_url = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $expected = $uploads_dir_url . $year_month . '/' . $image_meta['sizes']['medium']['file'] . ' ' . $image_meta['sizes']['medium']['width'] . 'w, ' .
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $uploads_dir_url . $year_month . '/' . $image_meta['sizes']['medium_large']['file'] . ' ' . $image_meta['sizes']['medium_large']['width'] . 'w, ' .
</ins><span class="cx" style="display: block; padding: 0 10px"> $uploads_dir_url . $year_month . '/' . $image_meta['sizes']['large']['file'] . ' ' . $image_meta['sizes']['large']['width'] . 'w, ' .
</span><span class="cx" style="display: block; padding: 0 10px"> $uploads_dir_url . $image_meta['file'] . ' ' . $image_meta['width'] . 'w';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Set up test cases for all expected size names and a random one.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $sizes = array( 'medium', 'large', 'full', 'yoav' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $sizes = array( 'medium', 'medium_large', 'large', 'full', 'yoav' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $sizes as $size ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $image_url = wp_get_attachment_image_url( self::$large_id, $size );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -773,11 +776,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $uploads_dir_url = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $expected = $uploads_dir_url . $image_meta['sizes']['medium']['file'] . ' ' . $image_meta['sizes']['medium']['width'] . 'w, ' .
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $uploads_dir_url . $image_meta['sizes']['medium_large']['file'] . ' ' . $image_meta['sizes']['medium_large']['width'] . 'w, ' .
</ins><span class="cx" style="display: block; padding: 0 10px"> $uploads_dir_url . $image_meta['sizes']['large']['file'] . ' ' . $image_meta['sizes']['large']['width'] . 'w, ' .
</span><span class="cx" style="display: block; padding: 0 10px"> $uploads_dir_url . $image_meta['file'] . ' ' . $image_meta['width'] . 'w';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Set up test cases for all expected size names and a random one.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $sizes = array( 'medium', 'large', 'full', 'yoav' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $sizes = array( 'medium', 'medium_large', 'large', 'full', 'yoav' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $sizes as $size ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $size_array = $this->_get_image_size_array_from_name( $size );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -806,6 +810,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $filename_base = basename( $image_meta['file'], '.png' );
</span><span class="cx" style="display: block; padding: 0 10px"> $image_meta['file'] = str_replace( $filename_base, $filename_base . '-' . $hash, $image_meta['file'] );
</span><span class="cx" style="display: block; padding: 0 10px"> $image_meta['sizes']['medium']['file'] = str_replace( $filename_base, $filename_base . '-' . $hash, $image_meta['sizes']['medium']['file'] );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $image_meta['sizes']['medium_large']['file'] = str_replace( $filename_base, $filename_base . '-' . $hash, $image_meta['sizes']['medium_large']['file'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> $image_meta['sizes']['large']['file'] = str_replace( $filename_base, $filename_base . '-' . $hash, $image_meta['sizes']['large']['file'] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Calculate a srcset array.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -857,6 +862,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $expected = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $year_month = date('Y/m') . '/'
</span><span class="cx" style="display: block; padding: 0 10px"> . $image_meta['sizes']['medium']['file'] . ' ' . $image_meta['sizes']['medium']['width'] . 'w, ';
</span><span class="cx" style="display: block; padding: 0 10px"> $expected .= 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $year_month = date('Y/m') . '/'
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ . $image_meta['sizes']['medium_large']['file'] . ' ' . $image_meta['sizes']['medium_large']['width'] . 'w, ';
+ $expected .= 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $year_month = date('Y/m') . '/'
</ins><span class="cx" style="display: block; padding: 0 10px"> . $image_meta['sizes']['large']['file'] . ' ' . $image_meta['sizes']['large']['width'] . 'w, ';
</span><span class="cx" style="display: block; padding: 0 10px"> $expected .= 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_meta['file'] . ' ' . $image_meta['width'] .'w';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -883,7 +890,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function test_wp_get_attachment_image_sizes() {
</span><span class="cx" style="display: block; padding: 0 10px"> // Test sizes against the default WP sizes.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $intermediates = array( 'thumbnail', 'medium', 'large' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $intermediates = array('thumbnail', 'medium', 'medium_large', 'large');
</ins><span class="cx" style="display: block; padding: 0 10px"> $image_meta = wp_get_attachment_metadata( self::$large_id );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach( $intermediates as $int_size ) {
</span></span></pre></div>
<a id="trunktestsphpunittestspostattachmentsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/post/attachments.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/post/attachments.php 2015-10-31 20:38:07 UTC (rev 35478)
+++ trunk/tests/phpunit/tests/post/attachments.php 2015-10-31 20:49:26 UTC (rev 35479)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -35,13 +35,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // intermediate copies should not exist
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( image_get_intermediate_size($id, 'thumbnail') );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( image_get_intermediate_size($id, 'medium') );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertFalse( image_get_intermediate_size($id, 'medium_large') );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // medium and full size will both point to the original
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // medium, medium_large, and full size will both point to the original
</ins><span class="cx" style="display: block; padding: 0 10px"> $downsize = image_downsize($id, 'medium');
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( basename( $upload['file'] ), basename($downsize[0]) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 50, $downsize[1] );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 50, $downsize[2] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $downsize = image_downsize($id, 'medium_large');
+ $this->assertEquals( basename( $upload['file'] ), basename($downsize[0]) );
+ $this->assertEquals( 50, $downsize[1] );
+ $this->assertEquals( 50, $downsize[2] );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $downsize = image_downsize($id, 'full');
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( basename( $upload['file'] ), basename($downsize[0]) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 50, $downsize[1] );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -72,6 +78,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path']) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( image_get_intermediate_size($id, 'medium') );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertFalse( image_get_intermediate_size($id, 'medium_large') );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // the thumb url should point to the thumbnail intermediate
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $thumb['url'], wp_get_attachment_thumb_url($id) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -82,12 +89,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 150, $downsize[1] );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 150, $downsize[2] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // medium and full will both point to the original
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // medium, medium_large, and full will both point to the original
</ins><span class="cx" style="display: block; padding: 0 10px"> $downsize = image_downsize($id, 'medium');
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'a2-small.jpg', basename($downsize[0]) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 400, $downsize[1] );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 300, $downsize[2] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $downsize = image_downsize($id, 'medium_large');
+ $this->assertEquals( 'a2-small.jpg', basename($downsize[0]) );
+ $this->assertEquals( 400, $downsize[1] );
+ $this->assertEquals( 300, $downsize[2] );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $downsize = image_downsize($id, 'full');
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 'a2-small.jpg', basename($downsize[0]) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 400, $downsize[1] );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -95,13 +107,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function test_insert_image_medium() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function test_insert_image_medium_sizes() {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( !function_exists( 'imagejpeg' ) )
</span><span class="cx" style="display: block; padding: 0 10px"> $this->markTestSkipped( 'jpeg support unavailable' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> update_option('medium_size_w', 400);
</span><span class="cx" style="display: block; padding: 0 10px"> update_option('medium_size_h', 0);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ update_option('medium_large_size_w', 600);
+ update_option('medium_large_size_h', 0);
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $filename = ( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG' );
</span><span class="cx" style="display: block; padding: 0 10px"> $contents = file_get_contents($filename);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -120,6 +135,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path']) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $medium_large = image_get_intermediate_size($id, 'medium_large');
+ $this->assertEquals( '2007-06-17DSC_4173-600x904.jpg', $medium_large['file'] );
+ $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium_large['path']) );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // the thumb url should point to the thumbnail intermediate
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( $thumb['url'], wp_get_attachment_thumb_url($id) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -134,6 +153,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 400, $downsize[1] );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 602, $downsize[2] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $downsize = image_downsize($id, 'medium_large');
+ $this->assertEquals( '2007-06-17DSC_4173-600x904.jpg', basename($downsize[0]) );
+ $this->assertEquals( 600, $downsize[1] );
+ $this->assertEquals( 904, $downsize[2] );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $downsize = image_downsize($id, 'full');
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( '2007-06-17DSC_4173.jpg', basename($downsize[0]) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( 680, $downsize[1] );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -148,6 +172,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> update_option('medium_size_w', 400);
</span><span class="cx" style="display: block; padding: 0 10px"> update_option('medium_size_h', 0);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ update_option('medium_large_size_w', 600);
+ update_option('medium_large_size_h', 0);
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $filename = ( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG' );
</span><span class="cx" style="display: block; padding: 0 10px"> $contents = file_get_contents($filename);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -166,6 +193,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertEquals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path']) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $medium_large = image_get_intermediate_size($id, 'medium_large');
+ $this->assertEquals( '2007-06-17DSC_4173-600x904.jpg', $medium_large['file'] );
+ $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium_large['path']) );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $meta = wp_get_attachment_metadata($id);
</span><span class="cx" style="display: block; padding: 0 10px"> $original = $meta['file'];
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $original) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -175,6 +206,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( is_file($thumb['path']) );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( is_file($medium['path']) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertFalse( is_file($medium_large['path']) );
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( is_file($original) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre>
</div>
</div>
</body>
</html>