PHPackages                             tburry/pxgif - 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. tburry/pxgif

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

tburry/pxgif
============

A little class for generating 1×1 pixel gifs.

v1.0.0(12y ago)014MITPHPPHP &gt;=5.3.0

Since Jan 23Pushed 12y agoCompare

[ Source](https://github.com/tburry/pxgif)[ Packagist](https://packagist.org/packages/tburry/pxgif)[ RSS](/packages/tburry-pxgif/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

Pxgif
=====

[](#pxgif)

Pxgif is a little class for generating 1 pixel gifs.

Why do I need to generate 1 pixel gifs?
---------------------------------------

[](#why-do-i-need-to-generate-1-pixel-gifs)

You probably don't need to generate 1 pixel gifs unless you are a little [OCD](http://en.wikipedia.org/wiki/Ocd) about returning the correct content type from your rest api. And the purpose of this class is just that. Here are some use-cases:

- You are making a google-anlytics style tracker that adds an image to the page to track a pageview. You can write out a 1 pixel transparent gif with `echo Pxgif::gifStr(0, 0, 0, true)`.
- Say you are writing a php script to manipulate an image in some way (ex. facebook passes most images through a safe\_image.php script). If that script fails you should still write a valid image since the browser expecting one. You can write out a 1 pixel gif to indicate the http error code `echo Pxgif::httpStr($code)`.

Installation
------------

[](#installation)

To use Pxgif you only need to include one file: **Pxgif.php**. Then all you need to do is call any of the static methods on the Pxgif class.

Basic Example
-------------

[](#basic-example)

The following example will output a 1 pixel transparent gif.

```
// Require the class.
require 'Pixgif.php';

// Do something interesting, like track a page view.
// ...

// Set the appropriate response headers.
header("Content-type:  image/gif");
header("Expires: Wed, 11 Nov 1998 11:11:11 GMT");
header("Cache-Control: no-cache");
header("Cache-Control: must-revalidate");

// Dump the gif.
Pxgif::gifStr();

```

Fancy Http Status Colors (Oh My!)
---------------------------------

[](#fancy-http-status-colors-oh-my)

When you call `Pxgif::httpStr()` you will get a string that represents an a 1 pixel gif for an http status code. The gif is color-coded to represent the success or severity of the error.

The gifs are color coded according to their error types.

1xx Informational : black

2xx Success : green

3xx Redirection : blue (although you're unlikely to see this one)

4xx Client Error : orange

5xx Server error : red

### A Status Code Easter Egg

[](#a-status-code-easter-egg)

If you are really observant you'll be able to figure out the response code just by looking at the color of the generated gif (hint, read the hex code) (hint, hint: look at the source code).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

4493d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/da29e060f227028e8ee38bb5873ba2188fb5236b20b3dffec766c768019d8bd8?d=identicon)[tburry](/maintainers/tburry)

---

Top Contributors

[![tburry](https://avatars.githubusercontent.com/u/97432?v=4)](https://github.com/tburry "tburry (8 commits)")

---

Tags

phpimagegif

### Embed Badge

![Health badge](/badges/tburry-pxgif/health.svg)

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

###  Alternatives

[lciolecki/php-image-optimizer

PHP image file optimizer (uses https://github.com/bensquire/php-image-optim)

347.4k](/packages/lciolecki-php-image-optimizer)

PHPackages © 2026

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