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

convert-thumbnail switch added #259

Merged
merged 6 commits into from
Dec 9, 2024
Merged
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
16 changes: 16 additions & 0 deletions src/Options.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

Check warning on line 1 in src/Options.php

View workflow job for this annotation

GitHub Actions / PHP-CS-Fixer

Found violation(s) of type: phpdoc_separation

Check warning on line 1 in src/Options.php

View workflow job for this annotation

GitHub Actions / PHP-CS-Fixer

Found violation(s) of type: no_extra_blank_lines

Check warning on line 1 in src/Options.php

View workflow job for this annotation

GitHub Actions / PHP-CS-Fixer

Found violation(s) of type: blank_line_between_import_groups

declare(strict_types=1);

Expand Down Expand Up @@ -150,6 +150,8 @@
// Thumbnail Images Options
private bool $writeThumbnail = false;
private bool $writeAllThumbnails = false;
private ?string $convertThumbnail = null;


// Verbosity / Simulation Options
private bool $skipDownload = false;
Expand Down Expand Up @@ -1023,6 +1025,18 @@
return $new;
}

/**
* Convert thumbnail to another format.
* @param 'jpg'|'png'|'webp'|null $format
*/
public function convertThumbnail(?string $format): self
{
$new = clone $this;
$new->convertThumbnail = $format;

return $new;
}

/**
* Write all thumbnail image formats to disk.
*/
Expand Down Expand Up @@ -1837,6 +1851,8 @@
// Thumbnail Images Options
'write-thumbnail' => $this->writeThumbnail,
'write-all-thumbnails' => $this->writeAllThumbnails,
'convert-thumbnail' => $this->convertThumbnail,

// Verbosity / Simulation Options
'skip-download' => $this->skipDownload,
'verbose' => $this->verbose,
Expand Down
Loading