mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 00:06:55 +02:00
Fix issue processwire/processwire-issues#222 with InputfieldImage thumbnail logic
This commit is contained in:
@@ -302,7 +302,7 @@ class InputfieldImage extends InputfieldFile implements InputfieldItemList, Inpu
|
|||||||
if(!$this->noAjax) {
|
if(!$this->noAjax) {
|
||||||
|
|
||||||
$dropLabel = $this->uploadOnlyMode ? $this->labels['drag-drop'] : $this->labels['drag-drop-in'];
|
$dropLabel = $this->uploadOnlyMode ? $this->labels['drag-drop'] : $this->labels['drag-drop-in'];
|
||||||
$refreshLabel = $this->_('legacy thumbnails will be re-created on save');
|
// $refreshLabel = $this->('legacy thumbnails will be re-created on save');
|
||||||
|
|
||||||
$out .= "
|
$out .= "
|
||||||
<span class='AjaxUploadDropHere description'>
|
<span class='AjaxUploadDropHere description'>
|
||||||
@@ -441,7 +441,6 @@ class InputfieldImage extends InputfieldFile implements InputfieldItemList, Inpu
|
|||||||
$thumb = $img;
|
$thumb = $img;
|
||||||
$error = '';
|
$error = '';
|
||||||
$attr = array();
|
$attr = array();
|
||||||
$is2x = false;
|
|
||||||
|
|
||||||
$_thumbHeight = $thumb->height;
|
$_thumbHeight = $thumb->height;
|
||||||
$thumbHeight = $_thumbHeight;
|
$thumbHeight = $_thumbHeight;
|
||||||
@@ -484,19 +483,18 @@ class InputfieldImage extends InputfieldFile implements InputfieldItemList, Inpu
|
|||||||
$thumbHeight = $this->gridSize;
|
$thumbHeight = $this->gridSize;
|
||||||
}
|
}
|
||||||
$this->set('_hasLegacyThumbs', true);
|
$this->set('_hasLegacyThumbs', true);
|
||||||
$is2x = false;
|
|
||||||
} else {
|
} else {
|
||||||
// use new thumbnail size, 260px (scaled to 130px in output)
|
// use new thumbnail size, 260px (scaled to 130px in output)
|
||||||
if($thumbWidth >= $thumbHeight && $thumbHeight > $gridSize2x) {
|
if($thumbWidth >= $thumbHeight) {
|
||||||
$thumb = $thumb->height($gridSize2x, $imageSizerOptions);
|
if($thumbHeight > $gridSize2x) {
|
||||||
$thumbHeight = $this->gridSize;
|
$thumb = $thumb->height($gridSize2x, $imageSizerOptions);
|
||||||
$thumbWidth = 0;
|
$thumbHeight = $this->gridSize;
|
||||||
$is2x = true;
|
$thumbWidth = 0;
|
||||||
|
}
|
||||||
} else if($thumbWidth > $gridSize2x) {
|
} else if($thumbWidth > $gridSize2x) {
|
||||||
$thumb = $thumb->width($gridSize2x, $imageSizerOptions);
|
$thumb = $thumb->width($gridSize2x, $imageSizerOptions);
|
||||||
$thumbWidth = $this->gridSize;
|
$thumbWidth = $this->gridSize;
|
||||||
$thumbHeight = 0;
|
$thumbHeight = 0;
|
||||||
$is2x = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -559,7 +557,7 @@ class InputfieldImage extends InputfieldFile implements InputfieldItemList, Inpu
|
|||||||
$sanitizer = $this->wire('sanitizer');
|
$sanitizer = $this->wire('sanitizer');
|
||||||
$thumb = $this->getAdminThumb($pagefile, false);
|
$thumb = $this->getAdminThumb($pagefile, false);
|
||||||
$fileStats = str_replace(' ', ' ', $pagefile->filesizeStr) . ", {$pagefile->width}×{$pagefile->height} ";
|
$fileStats = str_replace(' ', ' ', $pagefile->filesizeStr) . ", {$pagefile->width}×{$pagefile->height} ";
|
||||||
$gridSize = $this->gridSize;
|
// $gridSize = $this->gridSize;
|
||||||
|
|
||||||
// <div class='gridImage__overflow' style='width: {$gridSize}px; height: {$gridSize}px'>
|
// <div class='gridImage__overflow' style='width: {$gridSize}px; height: {$gridSize}px'>
|
||||||
$out = $this->getTooltip($pagefile) . "
|
$out = $this->getTooltip($pagefile) . "
|
||||||
@@ -700,6 +698,7 @@ class InputfieldImage extends InputfieldFile implements InputfieldItemList, Inpu
|
|||||||
|
|
||||||
if(!$this->useImageEditor) return '';
|
if(!$this->useImageEditor) return '';
|
||||||
|
|
||||||
|
if($n) {} // ignore, $n is for hooks
|
||||||
$pageID = $pagefile->pagefiles->page->id;
|
$pageID = $pagefile->pagefiles->page->id;
|
||||||
$variations = $this->getPagefileVariations($pagefile);
|
$variations = $this->getPagefileVariations($pagefile);
|
||||||
$variationCount = count($variations);
|
$variationCount = count($variations);
|
||||||
|
Reference in New Issue
Block a user