Skip to content

Commit bca5632

Browse files
committed
allow force save with same image size
1 parent c049b25 commit bca5632

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/ImageStack/ImageManipulator/ThumbnailRule/PatternThumbnailRule.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,19 @@ protected function _thumbnailImage(ImageWithImagineInterface $image, ImagePathIn
9090
throw new ImageNotFoundException(sprintf('Image not found: %s', $path->getPath()));
9191
}
9292

93+
if (is_null($format)) {
94+
// passthrough: we want the original image
95+
return true;
96+
}
97+
98+
// not very LSP but handy
99+
if (!$image->getImagine()) {
100+
$image->setImagine($this->getImagine(), $this->getImagineOptions());
101+
}
102+
93103
if (true === $format) {
94-
// we want the original image
104+
// we want the original image size but will trigger a save
105+
$image->deprecateBinaryContent();
95106
return true;
96107
}
97108

@@ -104,10 +115,6 @@ protected function _thumbnailImage(ImageWithImagineInterface $image, ImagePathIn
104115
} else {
105116
throw new ThumbnailRuleException(sprintf('Unsupported rule format: %s', (string)$format), ThumbnailRuleException::UNSUPPORTED_RULE_FORMAT);
106117
}
107-
// not very LSP but handy
108-
if (!$image->getImagine()) {
109-
$image->setImagine($this->getImagine(), $this->getImagineOptions());
110-
}
111118

112119
/** @var IImage $animated */
113120
$animated = null;

0 commit comments

Comments
 (0)