Driver
Contract implemented by every conversion backend.
Namespace: WebberZone\Image_Optimizer\Drivers
Since: 1.0.0
Source: includes/drivers/class-driver.php line 19
Methods
is_available() static
Whether the underlying PHP extension is loaded.
Since: 1.0.0
Line: 29
static public function is_available( ): bool;
Returns: bool — True when the extension is present.
get_name() static
Machine name of the driver.
Since: 1.0.0
Line: 38
static public function get_name( ): string;
Returns: string — Driver slug.
supports()
Whether this driver can encode the given target format.
Since: 1.0.0
Line: 48
public function supports( string $format ): bool;
| Type | Name | Description |
|---|---|---|
string |
$format |
Target format slug. |
Returns: bool — True when encoding is supported.
convert()
Encode without changing dimensions to preserve srcset alignment.
Since: 1.0.0
Line: 61
public function convert( string $source, string $destination, string $format, array $args ): true|\WP_Error;
| Type | Name | Description |
|---|---|---|
string |
$source |
Absolute path to the source image. |
string |
$destination |
Absolute path to write. |
string |
$format |
Target format slug. |
array |
$args |
Returns: true|\WP_Error — True on success, WP_Error on failure.