diff options
author | Robin Appelman <robin@icewind.nl> | 2021-01-05 18:35:39 +0300 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2021-01-05 18:42:11 +0300 |
commit | 3d10307869bf9c98ff19ee0cb8c5dacdf79f7987 (patch) | |
tree | 257325e8eef1d2d7a3d0dbd2261b38635732004e | |
parent | ef0f376466634510e9b7c8793b443878f45b7f59 (diff) |
remove nc19 compatibility
-rw-r--r-- | lib/Command/Generate.php | 40 | ||||
-rw-r--r-- | lib/Command/PreGenerate.php | 40 |
2 files changed, 24 insertions, 56 deletions
diff --git a/lib/Command/Generate.php b/lib/Command/Generate.php index 1f377cc..8210a9f 100644 --- a/lib/Command/Generate.php +++ b/lib/Command/Generate.php @@ -181,34 +181,18 @@ class Generate extends Command { } try { - if (method_exists(IPreview::class, 'generatePreviews')) { - $specifications = array_merge( - array_map(function ($squareSize) { - return ['width' => $squareSize, 'height' => $squareSize, 'crop' => true]; - }, $this->sizes['square']), - array_map(function ($heightSize) { - return ['width' => -1, 'height' => $heightSize, 'crop' => false]; - }, $this->sizes['height']), - array_map(function ($widthSize) { - return ['width' => $widthSize, 'height' => -1, 'crop' => false]; - }, $this->sizes['width']) - ); - $this->previewGenerator->generatePreviews($file, $specifications); - } else { - foreach ($this->sizes['square'] as $size) { - $this->previewGenerator->getPreview($file, $size, $size, true); - } - - // Height previews - foreach ($this->sizes['height'] as $height) { - $this->previewGenerator->getPreview($file, -1, $height, false); - } - - // Width previews - foreach ($this->sizes['width'] as $width) { - $this->previewGenerator->getPreview($file, $width, -1, false); - } - } + $specifications = array_merge( + array_map(function ($squareSize) { + return ['width' => $squareSize, 'height' => $squareSize, 'crop' => true]; + }, $this->sizes['square']), + array_map(function ($heightSize) { + return ['width' => -1, 'height' => $heightSize, 'crop' => false]; + }, $this->sizes['height']), + array_map(function ($widthSize) { + return ['width' => $widthSize, 'height' => -1, 'crop' => false]; + }, $this->sizes['width']) + ); + $this->previewGenerator->generatePreviews($file, $specifications); } catch (NotFoundException $e) { // Maybe log that previews could not be generated? } catch (\InvalidArgumentException $e) { diff --git a/lib/Command/PreGenerate.php b/lib/Command/PreGenerate.php index 09f4180..630aba0 100644 --- a/lib/Command/PreGenerate.php +++ b/lib/Command/PreGenerate.php @@ -200,34 +200,18 @@ class PreGenerate extends Command { } try { - if (method_exists(IPreview::class, 'generatePreviews')) { - $specifications = array_merge( - array_map(function ($squareSize) { - return ['width' => $squareSize, 'height' => $squareSize, 'crop' => true]; - }, $this->sizes['square']), - array_map(function ($heightSize) { - return ['width' => -1, 'height' => $heightSize, 'crop' => false]; - }, $this->sizes['height']), - array_map(function ($widthSize) { - return ['width' => $widthSize, 'height' => -1, 'crop' => false]; - }, $this->sizes['width']) - ); - $this->previewGenerator->generatePreviews($file, $specifications); - } else { - foreach ($this->sizes['square'] as $size) { - $this->previewGenerator->getPreview($file, $size, $size, true); - } - - // Height previews - foreach ($this->sizes['height'] as $height) { - $this->previewGenerator->getPreview($file, -1, $height, false); - } - - // Width previews - foreach ($this->sizes['width'] as $width) { - $this->previewGenerator->getPreview($file, $width, -1, false); - } - } + $specifications = array_merge( + array_map(function ($squareSize) { + return ['width' => $squareSize, 'height' => $squareSize, 'crop' => true]; + }, $this->sizes['square']), + array_map(function ($heightSize) { + return ['width' => -1, 'height' => $heightSize, 'crop' => false]; + }, $this->sizes['height']), + array_map(function ($widthSize) { + return ['width' => $widthSize, 'height' => -1, 'crop' => false]; + }, $this->sizes['width']) + ); + $this->previewGenerator->generatePreviews($file, $specifications); } catch (NotFoundException $e) { // Maybe log that previews could not be generated? } catch (\InvalidArgumentException $e) { |