mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 16:26:59 +02:00
Another adjustment to PageImage per issue #31
This commit is contained in:
@@ -14,6 +14,8 @@
|
|||||||
* Copyright (C) 2016 by Horst Nogajski and Ryan Cramer
|
* Copyright (C) 2016 by Horst Nogajski and Ryan Cramer
|
||||||
* This file licensed under Mozilla Public License v2.0 http://mozilla.org/MPL/2.0/
|
* This file licensed under Mozilla Public License v2.0 http://mozilla.org/MPL/2.0/
|
||||||
*
|
*
|
||||||
|
* @method bool resize($targetWidth, $targetHeight = 0)
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
class ImageSizer extends Wire {
|
class ImageSizer extends Wire {
|
||||||
|
|
||||||
|
@@ -686,6 +686,7 @@ class Pageimage extends Pagefile {
|
|||||||
// return hidpi width intended: scale omitted or provided in $width argument
|
// return hidpi width intended: scale omitted or provided in $width argument
|
||||||
$scale = $width;
|
$scale = $width;
|
||||||
if(!$scale || $scale < 0 || $scale > 1) $scale = 0.5;
|
if(!$scale || $scale < 0 || $scale > 1) $scale = 0.5;
|
||||||
|
if(is_string($options) && $options === "100%") return $options;
|
||||||
$width = is_array($options) ? 0 : (int) $options;
|
$width = is_array($options) ? 0 : (int) $options;
|
||||||
if($width < 1) $width = $this->width();
|
if($width < 1) $width = $this->width();
|
||||||
if($width === "100%") return $width;
|
if($width === "100%") return $width;
|
||||||
@@ -1119,8 +1120,8 @@ class Pageimage extends Pagefile {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$info['hidpiWidth'] = $this->hidpiWidth(null, $info['width']);
|
$info['hidpiWidth'] = $this->hidpiWidth(0, $info['width']);
|
||||||
$info['hidpiHeight'] = $this->hidpiWidth(null, $info['height']);
|
$info['hidpiHeight'] = $this->hidpiWidth(0, $info['height']);
|
||||||
|
|
||||||
if(empty($info['crop'])) {
|
if(empty($info['crop'])) {
|
||||||
// attempt to extract crop info from suffix
|
// attempt to extract crop info from suffix
|
||||||
|
Reference in New Issue
Block a user