load() public method

public load ( $uri )
Ejemplo n.º 1
0
 /**
  * Load URL
  *
  * @param $url
  */
 public function load($url)
 {
     $this->analyzer = new $this->fastImage();
     $this->analyzer->load($url);
 }
 /**
  * Fetch images via FastImage library
  *
  * @param array $urls_to_fetch Image src urls to fetch.
  * @param array $images Array to populate with results of image/dimension inspection.
  */
 private static function fetch_images_via_fast_image($urls_to_fetch, &$images)
 {
     require_once AMP__DIR__ . '/includes/lib/class-fastimage.php';
     $image = new FastImage();
     $urls = array();
     // array_column doesn't exist in PHP 5.2.
     foreach ($urls_to_fetch as $key => $value) {
         $urls[] = $key;
     }
     foreach ($urls as $url) {
         $result = $image->load($url);
         if (false === $result) {
             $images[$url]['size'] = self::STATUS_IMAGE_EXTRACTION_FAILED;
         } else {
             $size = $image->getSize();
             $images[$url]['size'] = $size;
         }
     }
 }