Skip to content

Commit

Permalink
Merge pull request #259 from mostafa-norouzi/master
Browse files Browse the repository at this point in the history
convert-thumbnail switch added
  • Loading branch information
norkunas authored Dec 9, 2024
2 parents 83ef03f + 26bb4ca commit ae4c07f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ class Options
// 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 @@ public function writeThumbnail(bool $writeThumbnail): self
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 @@ public function toArray(): array
// 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

0 comments on commit ae4c07f

Please sign in to comment.