PHPackages                             gstjohn/thumbsnag - 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. gstjohn/thumbsnag

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

gstjohn/thumbsnag
=================

Thumbsnag crawls an HTML document and finds imagery that best represents the given page.

v1.0.1(11y ago)11292MITPHP

Since Mar 16Pushed 10y ago1 watchersCompare

[ Source](https://github.com/gstjohn/Thumbsnag)[ Packagist](https://packagist.org/packages/gstjohn/thumbsnag)[ RSS](/packages/gstjohn-thumbsnag/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

Thumbsnag [![Build Status](https://camo.githubusercontent.com/6f0ee4a7a883f682f50cba3a01c75805d32ba0911d03f85763b52421b7a5f556/68747470733a2f2f7472617669732d63692e6f72672f6773746a6f686e2f5468756d62736e61672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/gstjohn/Thumbsnag)
============================================================================================================================================================================================================================================================================================

[](#thumbsnag-)

Thumbsnag crawls an HTML document and finds imagery that best represents the given page.

Example
-------

[](#example)

```
use Thumbsnag\FastImageAnalyzer;
use Thumbsnag\Thumbsnag;
use Thumbsnag\UrlDocument;

$url = 'http://simplegifts.co';
$html = file_get_contents($url);

$document = new DOMDocument();
$document->loadHTML($html);

$analyzer = new FastImageAnalyzer(new FastImage());

$thumbsnag = Thumbsnag::load(new UrlDocument($doc, $url), $analyzer);
$images = $thumbsnag->process();
```

After inspection, `$images` will return something like:

```
Array
(
  [1] => Thumbsnag\Image Object
  (
    [url:Thumbsnag\Image:private] => http://simplegifts.co/image1.jpg
    [height:Thumbsnag\Image:private] => 565
    [width:Thumbsnag\Image:private] => 849
  )

  [2] => Thumbsnag\Image Object
  (
    [url:Thumbsnag\Image:private] => http://simplegifts.co/image2.png
    [height:Thumbsnag\Image:private] => 450
    [width:Thumbsnag\Image:private] => 1162
  )
)
```

Configuration
-------------

[](#configuration)

### Step 1: Install

[](#step-1-install)

Pull the package in through Composer.

```
"require": {
  "gstjohn/thumbsnag": "~1.0"
}
```

### Step 2: Configure (as necessary)

[](#step-2-configure-as-necessary)

Thumbsnag::load() takes an array as its third parameter which overrides the default config. Available configuration options are:

- **min\_area (default: 5000)**

    This option represents the minimum pixel area (width x height) required in order to be included in the result set.
- **ratio\_threshold (default: 3.0)**

    This option represents the maximum ratio of width-to-height allowed in order to be included in the result set.
- **filename\_filters (default: "sprite", "blank", and "spacer")**

    This option represents an array of words that must not be in the image file name in order to be included in the result set.

Credits
-------

[](#credits)

- [How to Find the Image That Best Represents a Web Page](https://tech.shareaholic.com/2012/11/02/how-to-find-the-image-that-best-respresents-a-web-page/)
- [Crawlsane](https://github.com/michaelmcmillan/Crawlsane)

License
=======

[](#license)

Thumbsnag is open-sourced software licensed under the [MIT license](https://raw.githubusercontent.com/gstjohn/Thumbsnag/master/LICENSE).

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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

Every ~0 days

Total

2

Last Release

4074d ago

### Community

Maintainers

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

---

Top Contributors

[![gstjohn](https://avatars.githubusercontent.com/u/551124?v=4)](https://github.com/gstjohn "gstjohn (1 commits)")

---

Tags

thumbnailimagecrawleropengraph

### Embed Badge

![Health badge](/badges/gstjohn-thumbsnag/health.svg)

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

###  Alternatives

[intervention/image

PHP Image Processing

14.3k194.3M2.2k](/packages/intervention-image)[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)[h4cc/wkhtmltoimage-amd64

Convert html to image using webkit (qtwebkit). Static linked linux binary for amd64 systems.

20110.7M15](/packages/h4cc-wkhtmltoimage-amd64)[intervention/image-laravel

Laravel Integration of Intervention Image

1496.5M102](/packages/intervention-image-laravel)[james-heinrich/phpthumb

The PHP thumbnail generator

318516.1k6](/packages/james-heinrich-phpthumb)[folklore/image

Image manipulation library for Laravel 5 based on Imagine and inspired by Croppa for easy url based manipulation

270248.2k5](/packages/folklore-image)

PHPackages © 2026

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