Open AIC-BV opened 1 year ago
Feel free to submit a PR 😉
@bennothommo can you copy the tags over to this repo?
@LukeTowers done :)
Thanks @bennothommo :)
I would say converting is as easy as
"tinify/tinify": "^1.6.1"
// DEFAULT
$source = Source::fromFile($tempPath);
$source->toFile($tempPath);
// NEW
$sourceWebp = Source::fromFile($tempPath);
$sourceWebp->convert(["type" => "image/webp"]);
$extension = $converted->result()->extension();
$pathWithoutExtension = substr($tempPath, 0, strrpos($tempPath, "."));
$sourceWebp->toFile($pathWithoutExtension . "." . $extension);
var_dump($extension);
var_dump($pathWithoutExtension);
var_dump($sourceWebp);
But it isn't doing anything https://tinypng.com/developers/reference#converting-images
Would be nice if the plugin was extended to support WebP which appears to be a new feature of TinyPNG. This allows WinterCMS developers to be up to date with todays technology! 😄
Ideally it would serve automatically
.webp
if supported, if not a fallback to.png/.jpg
(only for Safari? It seems supported since end of 2022 so it still needs the fallback for users that didn't update their OS).Images would be compressed twice (once like it already is, and once as WebP) doubling the compressions and the price, so it should be optional with a toggle switch in the settings of the plugin