PHPackages                             andrewgjohnson/imagegradientrectangle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. andrewgjohnson/imagegradientrectangle

ActiveLibrary[Image &amp; Media](/categories/media)

andrewgjohnson/imagegradientrectangle
=====================================

imagegradientrectangle is a function that will draw a gradient filled rectangle on your PHP GD images

v1.1.0(6d ago)2251MITPHPPHP &gt;=5.0.0CI passing

Since Dec 9Pushed 6d ago1 watchersCompare

[ Source](https://github.com/andrewgjohnson/imagegradientrectangle)[ Packagist](https://packagist.org/packages/andrewgjohnson/imagegradientrectangle)[ Docs](https://imagegradientrectangle.agjgd.org)[ GitHub Sponsors](https://github.com/andrewgjohnson)[ Patreon](https://www.patreon.com/agjopensource)[ RSS](/packages/andrewgjohnson-imagegradientrectangle/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (4)Dependencies (6)Versions (6)Used By (1)

imagegradientrectangle
======================

[](#imagegradientrectangle)

[![MIT License](https://camo.githubusercontent.com/04922227901ae9b0742e739b586a385fdacbb439766ee50870ea8db097378794/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d3033363664362e706e673f636f6c6f72423d303336366436267374796c653d666c61742d737175617265)](https://github.com/andrewgjohnson/imagegradientrectangle/blob/master/LICENSE)[![Current Release](https://camo.githubusercontent.com/9135d9888db00e00c314ff0faa4ae1f4e66ca1abe19d4057534b9a68225ee7f3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f616e64726577676a6f686e736f6e2f696d6167656772616469656e7472656374616e676c652e706e673f636f6c6f72423d303336366436267374796c653d666c61742d737175617265266c6f676f436f6c6f723d7768697465266c6f676f3d676974687562)](https://github.com/andrewgjohnson/imagegradientrectangle/releases)[![Contributors](https://camo.githubusercontent.com/4c97ab75abf5935850ce58ed6d18f4a084e3f8579ab0ceaa7d7c3bb064d09815/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f616e64726577676a6f686e736f6e2f696d6167656772616469656e7472656374616e676c652e706e673f636f6c6f72423d303336366436267374796c653d666c61742d737175617265266c6f676f436f6c6f723d7768697465266c6f676f3d676974687562)](https://github.com/andrewgjohnson/imagegradientrectangle/graphs/contributors)[![Packagist Downloads](https://camo.githubusercontent.com/af3756d93a53b1d21b71d99641b6b92c5f865120df375bb1255ae14e78e56991/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616e64726577676a6f686e736f6e2f696d6167656772616469656e7472656374616e676c652e706e673f636f6c6f72423d303336366436267374796c653d666c61742d737175617265266c6f676f436f6c6f723d7768697465266c6f676f3d7061636b6167697374)](https://packagist.org/packages/andrewgjohnson/imagegradientrectangle/stats)[![Issues](https://camo.githubusercontent.com/613afde0a162af81d4154e5b587d2c0ed49788d9fff1f6b98e4e54d46e8662ed/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f616e64726577676a6f686e736f6e2f696d6167656772616469656e7472656374616e676c652e706e673f636f6c6f72423d303336366436267374796c653d666c61742d737175617265266c6f676f436f6c6f723d7768697465266c6f676f3d676974687562)](https://github.com/andrewgjohnson/imagegradientrectangle/issues)[![Patreon](https://camo.githubusercontent.com/48b89737bcc3f614ee651ed29763d606372ddf46e6c4a52be817465f17361cc1/68747470733a2f2f696d6167656772616469656e7472656374616e676c652e61676a67642e6f72672f646f63756d656e746174696f6e2f696d6167656772616469656e7472656374616e676c652e61676a67642e6f72672f696d616765732f70617472656f6e2d62616467652e706e67)](https://patreon.com/agjopensource)

[![](https://camo.githubusercontent.com/ada033aa101ca986633457086ffea44d179e8c0c780a7a60f81ec8cc3c62e756/68747470733a2f2f696d6167656772616469656e7472656374616e676c652e61676a67642e6f72672f646f63756d656e746174696f6e2f696d6167656772616469656e7472656374616e676c652e61676a67642e6f72672f696d616765732f6176617461722e706e67)](https://imagegradientrectangle.agjgd.org/)

Description
-----------

[](#description)

**imagegradientrectangle** is a function that will draw a gradient filled rectangle on your PHP GD images.

[![Patreon - Become a Patron](https://camo.githubusercontent.com/24c60c4550632628010d5c53c8cf9abc46d101caea3a76f057bff8884850c3b5/68747470733a2f2f7261737465722e736869656c64732e696f2f62616467652f50617472656f6e2532302d6265636f6d6525323061253230506174726f6e2d4644333334412e706e673f7374796c653d666f722d7468652d6261646765266c6f676f3d70617472656f6e266c6f676f436f6c6f723d464433333441)](https://patreon.com/agjopensource)

**imagegradientrectangle** is an [agjgd](https://agjgd.org) project.

Usage
-----

[](#usage)

### With Composer

[](#with-composer)

This project offers support for the [Composer](https://getcomposer.org/) dependency manager. You can find the imagegradientrectangle package online on [packagist.org](https://packagist.org/packages/andrewgjohnson/imagegradientrectangle).

#### Install using Composer

[](#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

[](#without-composer)

To use without Composer add an [include](http://php.net/manual/function.include.php) to the [`imagegradientrectangle.php` source file](https://raw.githubusercontent.com/andrewgjohnson/imagegradientrectangle/master/source/imagegradientrectangle.php).

```
include_once 'source/imagegradientrectangle.php';

```

### Dependencies

[](#dependencies)

This project has external dependencies. If you use [Composer](https://getcomposer.org/) you will not need to worry as dependencies are handled automatically. If you do not use Composer you will need to manage these dependencies yourself.

#### Dependencies List

[](#dependencies-list)

- [**imageblendedcolorallocate**](https://github.com/andrewgjohnson/imageblendedcolorallocate) is a function that will allocate a new blended color based on two existing allocated colors for your PHP GD images *([source](https://raw.githubusercontent.com/andrewgjohnson/imageblendedcolorallocate/1ed92d79a66fd3562af3fc9b71468725a8569db8/source/imageblendedcolorallocate.php))*

Examples
--------

[](#examples)

```
$red  = imagecolorallocate($im, 0xFF, 0x00, 0x00);
$blue = imagecolorallocate($im, 0x00, 0x00, 0xFF);

// Standard method to draw solid filled rectangles
imagefilledrectangle($im, 10, 10, 100, 100, $red);
imagefilledrectangle($im, 10, 10, 100, 100, $blue);

// This will draw a red-to-blue gradient filled rectangle (vertical gradient)
imagegradientrectangle($im, 10, 10, 100, 100, $red, $blue);

// This will draw a red-to-blue gradient filled rectangle (horizontal gradient)
imagegradientrectangle($im, 10, 10, 100, 100, $red, $blue, true);

```

There are [other examples](https://github.com/andrewgjohnson/imagegradientrectangle/tree/master/examples) included in the GitHub repository and on [imagegradientrectangle.agjgd.org](https://imagegradientrectangle.agjgd.org/examples/).

Help Requests
-------------

[](#help-requests)

Please post any questions in the [discussions area](https://github.com/andrewgjohnson/imagegradientrectangle/discussions) on GitHub if you need help.

If you discover a bug please [enter an issue](https://github.com/andrewgjohnson/imagegradientrectangle/issues/new) on GitHub. When submitting an issue please use our [issue template](https://github.com/andrewgjohnson/imagegradientrectangle/blob/master/ISSUE_TEMPLATE.md).

Contributing
------------

[](#contributing)

Please read our [contributing guidelines](https://github.com/andrewgjohnson/imagegradientrectangle/blob/master/.github/CONTRIBUTING.md) if you want to contribute.

You can contribute financially by becoming a [patron](https://patreon.com/agjopensource) at [patreon.com/agjopensource](https://patreon.com/agjopensource) to support imagegradientrectangle and [other agjgd.org projects](https://agjgd.org/projects/).

[![Patreon - Become a Patron](https://camo.githubusercontent.com/24c60c4550632628010d5c53c8cf9abc46d101caea3a76f057bff8884850c3b5/68747470733a2f2f7261737465722e736869656c64732e696f2f62616467652f50617472656f6e2532302d6265636f6d6525323061253230506174726f6e2d4644333334412e706e673f7374796c653d666f722d7468652d6261646765266c6f676f3d70617472656f6e266c6f676f436f6c6f723d464433333441)](https://patreon.com/agjopensource)

Acknowledgements
----------------

[](#acknowledgements)

This project was started by [Andrew G. Johnson (@andrewgjohnson)](https://github.com/andrewgjohnson).

Full list of contributors:

- [Andrew G. Johnson (@andrewgjohnson)](https://github.com/andrewgjohnson)

Our [security policies and procedures](https://github.com/andrewgjohnson/imagegradientrectangle/blob/master/.github/SECURITY.md) comes via the [atomist/samples](https://github.com/atomist/samples/blob/master/SECURITY.md) project. Our [issue templates](https://github.com/andrewgjohnson/imagegradientrectangle/tree/master/.github/ISSUE_TEMPLATE) comes via the [tensorflow/tensorflow](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md) project. Our [pull request template](https://github.com/andrewgjohnson/imagegradientrectangle/blob/master/.github/PULL_REQUEST_TEMPLATE.md) comes via the [stevemao/github-issue-templates](https://github.com/stevemao/github-issue-templates) project. The [mountains photo](https://unsplash.com/photos/qJvpykJ5SKs) comes via [Gabriel Garcia Marengo](https://unsplash.com/@gabrielgm).

Changelog
---------

[](#changelog)

You can find all notable changes in the [changelog](https://github.com/andrewgjohnson/imagegradientrectangle/blob/master/CHANGELOG.md).

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance99

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 95.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~677 days

Total

5

Last Release

6d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3a2c654feaba88830ba4fd37496255b92c6404cb78f5e7d90186da1496141986?d=identicon)[andrewgjohnson](/maintainers/andrewgjohnson)

---

Top Contributors

[![andrewgjohnson](https://avatars.githubusercontent.com/u/1124501?v=4)](https://github.com/andrewgjohnson "andrewgjohnson (20 commits)")[![ImgBotApp](https://avatars.githubusercontent.com/u/31427850?v=4)](https://github.com/ImgBotApp "ImgBotApp (1 commits)")

---

Tags

composergdgraphicsimageimagesphpimagegdgraphicsimages

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/andrewgjohnson-imagegradientrectangle/health.svg)

```
[![Health](https://phpackages.com/badges/andrewgjohnson-imagegradientrectangle/health.svg)](https://phpackages.com/packages/andrewgjohnson-imagegradientrectangle)
```

###  Alternatives

[intervention/image

PHP Image Processing

14.3k194.3M2.2k](/packages/intervention-image)[league/glide

Wonderfully easy on-demand image manipulation library with an HTTP based API.

2.6k51.2M116](/packages/league-glide)[gregwar/image

Image handling

1.0k4.1M51](/packages/gregwar-image)[rosell-dk/webp-convert

Convert JPEG &amp; PNG to WebP with PHP

6038.1M54](/packages/rosell-dk-webp-convert)[sybio/image-workshop

Powerful PHP class using GD library to work easily with images including layer notion (like Photoshop or GIMP)

860918.1k11](/packages/sybio-image-workshop)[andrewgjohnson/imagettftextblur

imagettftextblur is a drop in replacement for imagettftext with added parameters to add blur, glow and shadow effects to your PHP GD images

27198.4k1](/packages/andrewgjohnson-imagettftextblur)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
