Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add extraOptions property to transforms #15062

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/elements/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -1837,6 +1837,7 @@ public function getUrlsBySize(array $sizes, mixed $transform = null): array
'quality',
'width',
'fill',
'extraOptions',
]) : [];

if ($unit === 'w') {
Expand Down
2 changes: 2 additions & 0 deletions src/helpers/ImageTransforms.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public static function extendTransform(ImageTransform $transform, array $paramet
'quality',
'interlace',
'transformer',
'extraOptions',
];

$nullables = [
Expand Down Expand Up @@ -304,6 +305,7 @@ public static function normalizeTransform(mixed $transform): ?ImageTransform
'upscale',
'quality',
'interlace',
'extraOptions',
]);
}

Expand Down
7 changes: 7 additions & 0 deletions src/models/ImageTransform.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ class ImageTransform extends Model
*/
public ?bool $upscale = null;

/**
* @var array|null Extra options
* @since 4.4.0
*/
public ?array $extraOptions = null;

/**
* @var string The image transformer to use.
* @phpstan-var class-string<ImageTransformerInterface>
Expand Down Expand Up @@ -318,6 +324,7 @@ public function getConfig(): array
'quality' => $this->quality,
'upscale' => $this->upscale ?? Craft::$app->getConfig()->getGeneral()->upscaleImages,
'width' => $this->width,
'extraOptions' => $this->extraOptions,
];
}
}
Loading