Example #1
0
 /**
  * Inspect a URL for representative images
  *
  * @param UrlDocument       $document
  * @param ImageSizeAnalyzer $analyzer
  * @param array             $config
  * @return Thumbsnag
  */
 public static function load(UrlDocument $document, ImageSizeAnalyzer $analyzer, array $config = [])
 {
     $thumbsnag = new Thumbsnag($analyzer, $config);
     $thumbsnag->setDocument($document);
     return $thumbsnag;
 }
Example #2
0
<?php

use Thumbsnag\FastImageAnalyzer;
use Thumbsnag\Thumbsnag;
use Thumbsnag\UrlDocument;
require_once __DIR__ . '/../vendor/autoload.php';
libxml_use_internal_errors(true);
$url = 'http://simplegifts.co';
$html = file_get_contents($url);
$doc = new DOMDocument();
$doc->loadHTML($html);
$analyzer = new FastImageAnalyzer(new FastImage());
$thumbsnag = Thumbsnag::load(new UrlDocument($doc, $url), $analyzer);
$images = $thumbsnag->process();
print_r($images);