是否可以在 rosell-dk 包中转换没有 shell_exec() 或 exec() 的 webp 图像?

is it possible to convert webp image without shell_exec() or exec() in rosell-dk packages?

是否可以在 rosell-dk 包中不使用 shell_exec() 或 exec() 来转换 .webp 图像? 我使用 rosell-dk 包并通过作曲家安装。和 rosell-dk 包使用 shell_Exec() 或 exec() 函数。

假设您谈论的是 rosell-dk/webp-convert package, it looks like the 'gd' converter 使用 php-gd 扩展从 jpeg 转换为 webp,而不使用任何 shell 命令。

根据文档,您将强制包使用 'gd' 转换器,如下所示:

 <?php
// Initialise your autoloader (this example is using Composer)
require 'vendor/autoload.php';
use WebPConvert\WebPConvert;
$source = __DIR__ . '/logo.jpg';
$destination = __DIR__ . '/logo.jpg.webp';
$success = WebPConvert::convert($source, $destination, [
    'converters' => ['gd']
]);