nhujanen/image

GD Wrapper

0.0.2 2019-06-06 12:59 UTC

This package is auto-updated.

Last update: 2024-04-07 16:31:38 UTC


README

GD wrapper

Installing

composer require nhujanen/image

Requirements

PHP 7.1+ ext-gd with JPEG & PNG

Supports

  • JPEG
  • PNG
  • WEBP
  • GIF

Provides

  • Resizing (contain / cover -modes)
  • Cropping (middle focus / free focus)
  • Rotating (with cropping)
  • Mirroring (X&Y)
  • Rect (with X2/Y2 -support)
  • Colors
  • Drawing

Usage

See test/test.php

Basic usage example:

// Load test.png
$image = Wex\Image::load('test.png');

// Resize to 300x200 (contained)
$thumb = $image->resize(300, 200);

// Save image as JPEG
$thumb->saveAs(Wex\Image\JPEG::class, "test_thumb.jpg");