<?php
namespace Buglinjo\LaravelWebp;
use Buglinjo\LaravelWebp\Exceptions\CwebpShellExecutionFailed;
use Buglinjo\LaravelWebp\Interfaces\WebpInterface;
use Buglinjo\LaravelWebp\Traits\WebpTrait;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\File;
class Cwebp implements WebpInterface
{
use WebpTrait;
/**
* @var string
*/
protected $cwebpPath;
/**
* Cwebp constructor.
*/
public function __construct()
{
$this->cwebpPath = Config::get('laravel-webp.drivers.cwebp.path');
}
/**
* @param string $outputPath
* @param int|null $quality
* @return bool
* @throws CwebpShellExecutionFailed
*/
public function save(string $outputPath, int $quality = null): bool
{
$quality = $quality ?? $this->quality;
$cmd = $this->cwebpPath . ' -q ' . $quality . ' ' . $this->image->getPathname() . ' -o ' . $outputPath;
exec($cmd, $output, $exitCode);
if ($exitCode !== 0) {
throw new CwebpShellExecutionFailed($cmd, $output, $exitCode);
}
return File::exists($outputPath);
}
}
Checks the status of a payment.
**Response: SUCCESS (200 OK)**
{
"message": {
"success": [
"Success"
]
},
"data": {
"token": "2zMRmT3KeYT2BWMAyGhqEfuw4tOYOfGXKeyKqehZ8mF1E35hMwE69gPpyo3e",
"trx_id": "CP44657864",
"payer": {
"username": "testuser",
"email": "user@appdevs.net"
}
"status": "Test",
},
"type": "success"
}