AgjGd

MIT License Current Release Coveralls Coverage Packagist Downloads GitHub Contributors GitHub Issues Patreon

Description

AgjGd is a project that extends the functionality of PHP’s GD library started by Andrew G. Johnson. It is a single class, \AndrewGJohnson\AgjGd, with functionality exposed via public static methods.

Patreon - Become a Patron

Example

<?php

use AndrewGJohnson\AgjGd;

$image = imagecreatetruecolor(600, 300);
$font  = 'NotoSans-Regular.ttf';

// Fill the image with a red-to-blue gradient
AgjGd::imagegradientrectangle(
    $image,
    0,
    0,
    imagesx($image) - 1,
    imagesy($image) - 1,
    AgjGd::imagecolorallocatefromstring($image, 'red'),
    AgjGd::imagecolorallocatefromstring($image, 'blue')
);

// Wrap the text so that it does not overflow, then write it as blurred yellow text
$text = AgjGd::linebreaksfortext(30, 0, $font, 'Hello from AgjGd!', 500);

AgjGd::imagefttextfilter(
    $image,
    30,
    0,
    50,
    150,
    AgjGd::imagecolorallocatefromstring($image, 'yellow'),
    $font,
    $text,
    [],
    10
);

header('Content-Type: image/png');
imagepng($image);

You can find more examples and the full documentation for every method at AgjGd.org.

Methods

Usage

With Composer

This project offers support for the Composer dependency manager. You can find the AgjGd package online on packagist.org.

Install using Composer

Either run this command:

composer require andrewgjohnson/agjgd

or add this to the require section of your composer.json file:

"andrewgjohnson/agjgd": "2.*"

Without Composer

To use without Composer add a require_once call for the AgjGd.php source file.

require_once 'source/AndrewGJohnson/AgjGd.php';

Contributing

Please read our contributing guidelines if you want to contribute.

You can contribute financially by becoming a patron at patreon.com/agjopensource to support AgjGd.

Patreon - Become a Patron

Help Requests

Please post any questions in the discussions area of the GitHub repository.

If you discover a bug please enter an issue on the GitHub repository.

Acknowledgements

Full list of contributors:

Our security policies and procedures come via the atomist/samples project. Our pull request template comes via the stevemao/github-issue-templates project. The Jekyll theme was released by Andrew G. Johnson.

Changelog

You can find all notable changes in the changelog.