imagegradientrectangle
Description
imagegradientrectangle is a function that will draw a gradient filled rectangle on your PHP GD images.
Usage
With Composer
This project offers support for the Composer dependency manager. You can find the imagegradientrectangle package online on packagist.org.
Install using Composer
Either run this command:
composer require andrewgjohnson/imagegradientrectangle
or add this to the require
section of your composer.json file:
"andrewgjohnson/imagegradientrectangle": "1.*"
Without Composer
To use without Composer add an include to the imagegradientrectangle.php
source file.
include_once 'source/imagegradientrectangle.php';
Examples
// standard method to draw a red filled rectangle
$red = imagecolorallocate($im, 0xFF, 0x00, 0x00);
imagefilledrectangle($im, 10, 10, 100, 100, $red);
// standard method to draw a blue filled rectangle
$blue = imagecolorallocate($im, 0x00, 0x00, 0xFF);
imagefilledrectangle($im, 10, 10, 100, 100, $blue);
// this will draw a red-to-blue gradient filled rectangle
$red = imagecolorallocate($im, 0xFF, 0x00, 0x00);
$blue = imagecolorallocate($im, 0x00, 0x00, 0xFF);
imagegradientrectangle($im, 10, 10, 100, 100, $red, $blue);
There are other examples included in the GitHub repository and on imagegradientrectangle.org.
Help Requests
Please post any questions on stackoverflow.com if you need help.
If you discover a bug please enter an issue on GitHub. When submitting an issue please use our issue template.
Contributing
Please read our contributing guidelines if you want to contribute.
Acknowledgements
This project was started by Andrew G. Johnson (@andrewgjohnson).
Full list of contributors:
Our issue template & pull request template come via the stevemao/github-issue-templates project. The mountains photo comes via Gabriel Garcia Marengo.
Changelog
You can find all notable changes in the changelog.