Coder Social home page Coder Social logo

php-image-converter's Introduction

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

Donate to DevoneraAB if you want.

License

MIT

php-image-converter's People

Contributors

jenstornell avatar peter279k avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.