Example of how to generate webp image file from jpg or png image file with PHP. Created for learning purpose. Example project.
To use imagecreatefromstring PHP function (which is used in this example project) You need GD library. This library is probably active on Your online server but it is disabled by default on XAMPP. To activate GD library for XAMPP with PHP 8 support follow steps below.
- Go to xampp control panel
- Click Config Button
- From Dropdown open file PHP (php.ini)
- Fine ;extension=gd
- Remove ; from start
- Restart XAMPP server