Customizer: fix cropping of small images when setting header image, site icon or logo.
Props obenland. Fixes #36412. Built from https://develop.svn.wordpress.org/trunk@37167 git-svn-id: http://core.svn.wordpress.org/trunk@37134 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9363b592e3
commit
c353544c47
|
@ -2097,22 +2097,22 @@
|
|||
xInit = parseInt( control.params.width, 10 ),
|
||||
yInit = parseInt( control.params.height, 10 ),
|
||||
ratio = xInit / yInit,
|
||||
xImg = realWidth,
|
||||
yImg = realHeight,
|
||||
xImg = xInit,
|
||||
yImg = yInit,
|
||||
x1, y1, imgSelectOptions;
|
||||
|
||||
controller.set( 'canSkipCrop', ! control.mustBeCropped( flexWidth, flexHeight, xInit, yInit, realWidth, realHeight ) );
|
||||
|
||||
if ( xImg / yImg > ratio ) {
|
||||
yInit = yImg;
|
||||
if ( realWidth / realHeight > ratio ) {
|
||||
yInit = realHeight;
|
||||
xInit = yInit * ratio;
|
||||
} else {
|
||||
xInit = xImg;
|
||||
xInit = realWidth;
|
||||
yInit = xInit / ratio;
|
||||
}
|
||||
|
||||
x1 = ( xImg - xInit ) / 2;
|
||||
y1 = ( yImg - yInit ) / 2;
|
||||
x1 = ( realWidth - xInit ) / 2;
|
||||
y1 = ( realHeight - yInit ) / 2;
|
||||
|
||||
imgSelectOptions = {
|
||||
handles: true,
|
||||
|
@ -2121,6 +2121,8 @@
|
|||
persistent: true,
|
||||
imageWidth: realWidth,
|
||||
imageHeight: realHeight,
|
||||
minWidth: xImg > xInit ? xInit : xImg,
|
||||
minHeight: yImg > yInit ? yInit : yImg,
|
||||
x1: x1,
|
||||
y1: y1,
|
||||
x2: xInit + x1,
|
||||
|
@ -2130,11 +2132,15 @@
|
|||
if ( flexHeight === false && flexWidth === false ) {
|
||||
imgSelectOptions.aspectRatio = xInit + ':' + yInit;
|
||||
}
|
||||
if ( flexHeight === false ) {
|
||||
imgSelectOptions.maxHeight = yInit;
|
||||
|
||||
if ( true === flexHeight ) {
|
||||
delete imgSelectOptions.minHeight;
|
||||
imgSelectOptions.maxWidth = realWidth;
|
||||
}
|
||||
if ( flexWidth === false ) {
|
||||
imgSelectOptions.maxWidth = xInit;
|
||||
|
||||
if ( true === flexWidth ) {
|
||||
delete imgSelectOptions.minWidth;
|
||||
imgSelectOptions.maxHeight = realHeight;
|
||||
}
|
||||
|
||||
return imgSelectOptions;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.5-RC1-37166';
|
||||
$wp_version = '4.5-RC1-37167';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue