1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-08 15:57:01 +02:00

Another adjustment to PageImage per issue #31

This commit is contained in:
Ryan Cramer
2016-10-13 10:14:47 -04:00
parent 6336fd4438
commit 36c7b268e1
2 changed files with 5 additions and 2 deletions

View File

@@ -13,6 +13,8 @@
*
* Copyright (C) 2016 by Horst Nogajski and Ryan Cramer
* 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 {

View File

@@ -686,6 +686,7 @@ class Pageimage extends Pagefile {
// return hidpi width intended: scale omitted or provided in $width argument
$scale = $width;
if(!$scale || $scale < 0 || $scale > 1) $scale = 0.5;
if(is_string($options) && $options === "100%") return $options;
$width = is_array($options) ? 0 : (int) $options;
if($width < 1) $width = $this->width();
if($width === "100%") return $width;
@@ -1119,8 +1120,8 @@ class Pageimage extends Pagefile {
return false;
}
$info['hidpiWidth'] = $this->hidpiWidth(null, $info['width']);
$info['hidpiHeight'] = $this->hidpiWidth(null, $info['height']);
$info['hidpiWidth'] = $this->hidpiWidth(0, $info['width']);
$info['hidpiHeight'] = $this->hidpiWidth(0, $info['height']);
if(empty($info['crop'])) {
// attempt to extract crop info from suffix