PHP code example of woltlab / webp-exif

1. Go to this page and download the library: Download woltlab/webp-exif library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

woltlab / webp-exif example snippets



$binary = \file_get_contents("example.webp");

$decoder = new Decoder();
$webp = $decoder->fromBinary($binary);
if ($webp->getExif() !== null) {
    // Extract the EXIF data to store it separate from the file.
    $exifData = $webp->getExif()->getRawBytes();
    // … or just retrieve the parsed EXIF data.
    \var_dump($webp->getExif()->getParsedExif());

    // Strip the EXIF data.
    $webp->withExif(null);
}

$encoder = new Encoder();
$binary = $encoder->fromWebP($webp);