2017 © Pedro Peláez
 

library gd-wrapper

A GD wrapper

image

jlaso/gd-wrapper

A GD wrapper

  • Wednesday, October 5, 2016
  • by jlaso
  • Repository
  • 1 Watchers
  • 1 Stars
  • 21 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

image

image wrapper for PHP GD image, (*1)

I created this package with the only intention to write compact and understandable scripts., (*2)

The idea is to use this:, (*3)

$image = new Image(800, 600);

$image
    ->createColor('black', new Color(['R' => 0, 'G' => 0, 'B' => 0]))
    ->createColor('white', new Color(['R' => 255, 'G' => 255, 'B' => 255]))
    ->setColor('black')
    ->fill()
    ->setColor('white')
    ->fill(new Ellipse(new Point(400, 300), 200, 150))
    ->setColor('black')
    ->fill(new Circle(new Point(400, 300), 100))
    ->setColor('white')
    ->fill(new Circle(new Point(400, 300), 30))
    ->saveAsPng('/tmp/eye.png');

Instead of this:, (*4)

$image = imagecreate(800, 600);

$black = imagecolorallocate($image, 0, 0, 0); 
$white = imagecolorallocate($image, 255, 255, 255);

imagefill($image, 0, 0, $black);

imagefilledellipse($image, 400, 300, 200, 150, $white);
imagefilledellipse($image, 400, 300, 100, 100, $black);
imagefilledellipse($image, 400, 300, 30, 30, $white);

imagepng($image, '/tmp/eye.png');

Example to write ellipses and circles:, (*5)

php sample-eye.php && open /tmp/eye.png

Eye example, (*6)

Example to write polygons:, (*7)

php sample-penta.php && open /tmp/penta.png

Polygon example, (*8)

Example to write text: take a look over sample-text.php, (*9)

php sample-text.php && open /tmp/text.png

Text example, (*10)

Example to use palette:, (*11)

php sample-palette.php && open /tmp/palette.png

Palette example, (*12)

Internal palettes had been imported from Jam3/nice-color-palettes, (*13)

200 palettes, (*14)

How to edit this file, (*15)

The Versions

05/10 2016

dev-master

9999999-dev https://github.com/jlaso/gd-wrapper

A GD wrapper

  Sources   Download

MIT

The Requires

  • php >=5.6

 

image gd graphics

02/10 2016

1.2

1.2.0.0 https://github.com/jlaso/gd-wrapper

A GD wrapper

  Sources   Download

MIT

The Requires

  • php >=5.6

 

image gd graphics