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 ),
|
xInit = parseInt( control.params.width, 10 ),
|
||||||
yInit = parseInt( control.params.height, 10 ),
|
yInit = parseInt( control.params.height, 10 ),
|
||||||
ratio = xInit / yInit,
|
ratio = xInit / yInit,
|
||||||
xImg = realWidth,
|
xImg = xInit,
|
||||||
yImg = realHeight,
|
yImg = yInit,
|
||||||
x1, y1, imgSelectOptions;
|
x1, y1, imgSelectOptions;
|
||||||
|
|
||||||
controller.set( 'canSkipCrop', ! control.mustBeCropped( flexWidth, flexHeight, xInit, yInit, realWidth, realHeight ) );
|
controller.set( 'canSkipCrop', ! control.mustBeCropped( flexWidth, flexHeight, xInit, yInit, realWidth, realHeight ) );
|
||||||
|
|
||||||
if ( xImg / yImg > ratio ) {
|
if ( realWidth / realHeight > ratio ) {
|
||||||
yInit = yImg;
|
yInit = realHeight;
|
||||||
xInit = yInit * ratio;
|
xInit = yInit * ratio;
|
||||||
} else {
|
} else {
|
||||||
xInit = xImg;
|
xInit = realWidth;
|
||||||
yInit = xInit / ratio;
|
yInit = xInit / ratio;
|
||||||
}
|
}
|
||||||
|
|
||||||
x1 = ( xImg - xInit ) / 2;
|
x1 = ( realWidth - xInit ) / 2;
|
||||||
y1 = ( yImg - yInit ) / 2;
|
y1 = ( realHeight - yInit ) / 2;
|
||||||
|
|
||||||
imgSelectOptions = {
|
imgSelectOptions = {
|
||||||
handles: true,
|
handles: true,
|
||||||
|
@ -2121,6 +2121,8 @@
|
||||||
persistent: true,
|
persistent: true,
|
||||||
imageWidth: realWidth,
|
imageWidth: realWidth,
|
||||||
imageHeight: realHeight,
|
imageHeight: realHeight,
|
||||||
|
minWidth: xImg > xInit ? xInit : xImg,
|
||||||
|
minHeight: yImg > yInit ? yInit : yImg,
|
||||||
x1: x1,
|
x1: x1,
|
||||||
y1: y1,
|
y1: y1,
|
||||||
x2: xInit + x1,
|
x2: xInit + x1,
|
||||||
|
@ -2130,11 +2132,15 @@
|
||||||
if ( flexHeight === false && flexWidth === false ) {
|
if ( flexHeight === false && flexWidth === false ) {
|
||||||
imgSelectOptions.aspectRatio = xInit + ':' + yInit;
|
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;
|
return imgSelectOptions;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue