Php Image Converter Save

PHP library to convert between gif, jpeg, png and webp image files

Project README

PHP Image Converter

Version 1.2 beta

PHP library to convert between gif, jpeg, png and webp image files.

Usage

Syntax

echo \ImageConverter\convert(string $from , string $to , int $quality);

Example

<?php
include __DIR__ . '/src/php-image-converter.php';

$from = __DIR__ . '/my-image.png';
$to = __DIR__ . '/my-image.webp';

echo \ImageConverter\convert($from, $to);

Quality

The third argument is an optional $quality value. It will differ depending on your image format.

Format Default Min Max Description
gif null null null Quality value not supported
jpeg -1 0 100 Higher means better quality
png -1 0 9 Lower means better quality
webp 80 0 100 Higher means better quality

Notes

If you try to convert to a path that has not been created, it will try to create it automatically.

Requirements

  • PHP 7+
  • GD (active on almost every server by default)

Contributors

Contributing

Please see contributing for details.

Inspiration

Donate to DevoneraAB if you want.

License

MIT

Open Source Agenda is not affiliated with "Php Image Converter" Project. README Source: free-open-source/php-image-converter
Stars
43
Open Issues
7
Last Commit
4 years ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating