Fetch compressor only once during resize
This commit is contained in:
parent
f419888ec6
commit
dcbcae32e7
|
@ -90,8 +90,10 @@ class ImageResizer
|
||||||
|
|
||||||
private function generateVersions(): void
|
private function generateVersions(): void
|
||||||
{
|
{
|
||||||
|
$compressor = $this->file->compressor();
|
||||||
|
|
||||||
foreach ($this->possibleSizes() as $size) {
|
foreach ($this->possibleSizes() as $size) {
|
||||||
$this->file->compressor()->resize($size, $this->update, function($media, $file) {
|
$compressor->resize($size, $this->update, function($media, $file) {
|
||||||
if (!file_exists($file)) {
|
if (!file_exists($file)) {
|
||||||
throw new ResizerException('File versions cannot be generated. Version file "'.$file.'" of "'.$this->file->root().'" doesnt exist.');
|
throw new ResizerException('File versions cannot be generated. Version file "'.$file.'" of "'.$this->file->root().'" doesnt exist.');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue