gevo/sqip_img_converter

Converts image to placeholders using sqip

v1.0.0 2024-02-24 10:41 UTC

This package is auto-updated.

Last update: 2025-08-24 14:37:20 UTC


README

This project provides a PHP class for converting images to SVG placeholders using Sqip.

Installation

Use composer to install the project:

composer require gevo/img-converter-sqip

Packagist link

Make sure to have sqip globally installed on your machine following the official guide

Usage

use Gevo\ImgConverterSqip\Converter;

$converter = new Converter($inputPath, $outputPath);
$converter->convert();

In this example, $inputPath is the path to the input image and $outputPath is the path where the SVG placeholder should be saved.

Exception Handling

The convert method may throw an ImgConverterSqipException if there's a problem during the conversion process. You should catch this exception in your code and handle it appropriately.

use Gevo\ImgConverterSqip\Converter;
use Gevo\ImgConverterSqip\ImgConverterSqipException;

try {
    $converter = new Converter($inputPath, $outputPath);
    $converter->convert();
} catch (ImgConverterSqipException $e) {
    // Handle exception
}

License

This project is licensed under the MIT License.