Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
fixed missing crop option
Browse files Browse the repository at this point in the history
  • Loading branch information
bnomei committed Jul 18, 2019
1 parent 843b4c4 commit 55b284d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions classes/Imageoptim.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,21 @@ public static function thumb($src, $dst, $options)
}
}
if ($request) {
$fit = A::get($settings, 'crop', 'crop');
$fit = \Kirby\Toolkit\A::get($settings, 'crop', 'crop');
$allowedFitOptions = ['fit', 'crop', 'scale-down', 'pad'];
if (null !== $fit && !in_array($fit, $allowedFitOptions)) {
$fit = 'crop';
}
$request = $request->resize(
A::get($settings, 'width'),
A::get($settings, 'height'),
A::get($settings, 'height') === null ? null : $fit
\Kirby\Toolkit\A::get($settings, 'width'),
\Kirby\Toolkit\A::get($settings, 'height'),
\Kirby\Toolkit\A::get($settings, 'height') === null ? null : $fit
);
if ($io_quality = A::get($settings, 'io_quality')) {
if ($io_quality = \Kirby\Toolkit\A::get($settings, 'io_quality')) {
$request = $request->quality($io_quality);
}
if ($io_dpr = A::get($settings, 'io_dpr')) {
$request = intval($request->dpr($io_dpr));
if ($io_dpr = \Kirby\Toolkit\A::get($settings, 'io_dpr')) {
$request = $request->dpr(intval($io_dpr));
}

if ($tl = option('bnomei.thumbimageoptim.timelimit')) {
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "bnomei/kirby3-thumb-imageoptim",
"description": "Kirby 3 Thumb Driver using Imageoptim",
"type": "kirby-plugin",
"version": "1.3.2",
"version": "1.3.3",
"license": "MIT",
"authors": [
{
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 55b284d

Please sign in to comment.