Skip to content

Commit

Permalink
Fixed an issue where multiple resizes didn't consider a new source im…
Browse files Browse the repository at this point in the history
…age.
  • Loading branch information
tmannherz committed Sep 27, 2019
1 parent 5a67590 commit 0fd05e9
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/Adapter/Local.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,18 @@ class Local implements AdapterInterface

public function resize(string $source, string $destination, StrategyInterface $strategy): bool
{
if (!$this->resizer) {
try {
$this->resizer = new ImageResize($source);
} catch (ImageResizeException $e) {
throw new ResizeException($e->getMessage(), ResizeException::CODE_NOT_FOUND, $e);
}
$this->resizer->gamma_correct = false;
if ($strategy->quality) {
$this->resizer->quality_jpg = $this->normalizeJpgQuality($strategy->quality);
$this->resizer->quality_png = $this->normalizePngQuality($strategy->quality);
} else {
$this->resizer->quality_jpg = $this->defaultJpgQuality;
$this->resizer->quality_png = $this->defaultPngQuality;
}
try {
$this->resizer = new ImageResize($source);
} catch (ImageResizeException $e) {
throw new ResizeException($e->getMessage(), ResizeException::CODE_NOT_FOUND, $e);
}
$this->resizer->gamma_correct = false;
if ($strategy->quality) {
$this->resizer->quality_jpg = $this->normalizeJpgQuality($strategy->quality);
$this->resizer->quality_png = $this->normalizePngQuality($strategy->quality);
} else {
$this->resizer->quality_jpg = $this->defaultJpgQuality;
$this->resizer->quality_png = $this->defaultPngQuality;
}
$this->strategy = $strategy;

Expand Down

0 comments on commit 0fd05e9

Please sign in to comment.