Convert images with PHP
This library enables you to do images conversion with PHP. It supports an abundance of methods for converting and automatically selects the most capable of these that is available on the system.
The library can convert using the following methods:
- using Imagick extension
- executing imagemagick binary using an
exec
call - using Vips PHP extension)
- executing ffmpeg binary using an
exec
call - using Gmagick extension
- executing graphicsmagick binary using an
exec
call - using the Gd extension)
- executing cwebp binary using an
exec
call (only used for converting images to webp) - using the ewww cloud converter
Installation
Require the library with Composer, like this:
composer require rosell-dk/image-convert
Converting images
Here is a minimal example of converting using the ImageConvert::convert method:
// Initialise your autoloader (this example is using Composer)
require 'vendor/autoload.php';
use ImageConvert\ImageConvert;
$source = __DIR__ . '/logo.jpg';
$destination = $source . '.webp';
$options = [];
ImageConvert::convert($source, $destination, $options);
Work in progress...
The library is under development. It works, but it is not production-ready.
Do you like what I do?
Perhaps you want to support my work, so I can continue doing it :)