Recent

CLIclass

CLI

Manage WebP and AVIF conversion from the command line.

Namespace: WebberZone\Image_Optimizer\CLI
Since: 1.0.0
Source: includes/cli/class-cli.php line 30

Methods

status()

Show what this server can encode and how much of the library is done.

EXAMPLES

wp wzio status

Since: 1.0.0
Line: 45

public function status( $args, $assoc_args ): void;
Type Name Description
mixed $args
mixed $assoc_args

Returns: void

convert()

Convert one or more attachments immediately.

OPTIONS

[…] : Attachment IDs to convert. Omit to convert everything not yet handled.

[–force] : Re-encode even when an up-to-date optimized copy already exists.

[–outdated] : Re-encode only attachments whose copies were made with older settings. Copies from before settings were tracked are left alone.

[–formats=] : Comma separated list of formats to generate, overriding the settings.

[–dry-run] : Report what would be converted without writing anything.

EXAMPLES

wp wzio convert 7214
wp wzio convert --formats=webp,avif --force

Since: 1.0.0
Line: 126

public function convert( $args, $assoc_args ): void;
Type Name Description
mixed $args
mixed $assoc_args

Returns: void

queue()

Add every unconverted attachment to the background queue.

OPTIONS

[–force] : Requeue attachments that already have a conversion record.

[–outdated] : Requeue only attachments whose copies were made with older settings.

EXAMPLES

wp wzio queue

Since: 1.0.0
Line: 266

public function queue( $args, $assoc_args ): void;
Type Name Description
mixed $args
mixed $assoc_args

Returns: void

run()

Work through the queue.

OPTIONS

[–batch=] : Attachments per batch. Defaults to the configured batch size.

[–max-batches=] : Stop after this many batches. Defaults to running until the queue is empty.

EXAMPLES

wp wzio run

Since: 1.0.0
Line: 298

public function run( $args, $assoc_args ): void;
Type Name Description
mixed $args
mixed $assoc_args

Returns: void

clean()

Delete the generated files for one or more attachments.

OPTIONS

[…] : Attachment IDs. Omit to clean every attachment that has a record.

[–yes] : Skip the confirmation prompt.

EXAMPLES

wp wzio clean 7214

Since: 1.0.0
Line: 360

public function clean( $args, $assoc_args ): void;
Type Name Description
mixed $args
mixed $assoc_args

Returns: void

compress()

Compress served JPEG/PNG originals with immutable backups.

OPTIONS

[–ids=] : Comma-separated attachment IDs. Omit for the whole library.

[–dry-run] : List candidate attachments without changing files, records or the queue.

[–resize] : Resize main files to the configured Maximum image dimension.

Line: 414

public function compress( $args, $assoc_args ): void;
Type Name Description
array $args Positional arguments.
array $assoc_args Named arguments.

Returns: void

restore_originals()

Restore original files and dimensions from backups.

OPTIONS

[–ids=] : Comma-separated attachment IDs.

[–all] : Restore every attachment with backups.

[–dry-run] : List attachments with backups without restoring them.

Line: 468

public function restore_originals( $args, $assoc_args ): void;
Type Name Description
array $args Positional arguments.
array $assoc_args Named arguments.

Returns: void