Save webp files as png

Hi,

I am trying to save webp files as png to the database. Is there any existing function to that? Your ideas are appreciated.

http://php.net/manual/en/function.imagepng.php

http://php.net/manual/en/function.imagecreatefromwebp.php

Since Yii 1.1 doesn’t include a native WebP conversion function, you’ll need to rely on PHP’s standard image processing.

If your server has Imagick installed, it’s just a couple of lines:

$image = new Imagick('path/to/file.webp');
$image->setImageFormat('png');
$image->writeImage('path/to/file.png');
$image->clear();

For manual or one-off file conversions outside your backend app, this web converter tool handles WebP to PNG locally in the browser so no files get sent to an external server.