2017 © Pedro Peláez
 

library thumbsnag

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

image

gstjohn/thumbsnag

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

  • Monday, March 16, 2015
  • by gstjohn
  • Repository
  • 1 Watchers
  • 11 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Thumbsnag Build Status

Thumbsnag crawls an HTML document and finds imagery that best represents the given page., (*1)

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:, (*2)

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

Step 1: Install

Pull the package in through Composer., (*3)

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

Step 2: Configure (as necessary)

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

  • min_area (default: 5000), (*5)

    This option represents the minimum pixel area (width x height) required in order to be included in the result set., (*6)

  • ratio_threshold (default: 3.0), (*7)

    This option represents the maximum ratio of width-to-height allowed in order to be included in the result set., (*8)

  • filename_filters (default: "sprite", "blank", and "spacer"), (*9)

    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., (*10)

Credits

License

Thumbsnag is open-sourced software licensed under the MIT license., (*11)

The Versions

16/03 2015

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Garrett St. John

image crawler thumbnail opengraph

16/03 2015

v1.0.1

1.0.1.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Garrett St. John

image crawler thumbnail opengraph

16/03 2015

v1.0.0

1.0.0.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Garrett St. John

image crawler thumbnail opengraph