/home/kueuepay/public_html/vendor/buglinjo/laravel-webp/src/Webp.php
<?php

namespace Buglinjo\LaravelWebp;

use Buglinjo\LaravelWebp\Exceptions\DriverIsNotSupportedException;
use Illuminate\Support\Facades\Config;
use Illuminate\Http\UploadedFile;

class Webp
{
    /**
     * @param UploadedFile $image
     * @return Cwebp|PhpGD|Traits\WebpTrait|null
     * @throws DriverIsNotSupportedException
     */
    public static function make(UploadedFile $image)
    {
        $driver = Config::get('laravel-webp.default_driver');
        $availableDrivers = Config::get('laravel-webp.drivers');

        if (!in_array($driver, array_keys($availableDrivers))) {
            throw new DriverIsNotSupportedException($driver);
        }

        switch ($driver) {
            case 'php-gd':
                return (new PhpGD())->make($image);
            case 'cwebp':
                return (new Cwebp())->make($image);
        }

        return null;
    }
}
Best Practice

Best Practices

To ensure a smooth integration process and optimal performance, follow these best practices:

  1. Use secure HTTPS connections for all API requests.
  2. Implement robust error handling to handle potential issues gracefully.
  3. Regularly update your integration to stay current with any API changes or enhancements.