src/Object/MediaObject.php
public function icon() {
		$url = $this->_stub['website'];
		if (!$url) {
			return null;
		}

		$pieces = parse_url($url);
		$url = $pieces['host'];

		$icon = 'http://www.google.com/s2/favicons?domain=';
		$icon .= $url;

		$context = stream_context_create(
			['http' => ['header' => 'Connection: close']]);
		// E.g. http://www.google.com/s2/favicons?domain=xyz.com
		$file = file_get_contents($icon, false, $context);
		if ($file === false) {
			return null;
		}
		// TODO: transform into 16x16 png
		return $file;
	}
public function icon() {
		$url = $this->_stub['website'];
		if (!$url) {
			return null;
		}

		$pieces = parse_url($url);
		$url = $pieces['host'];

		$icon = 'http://www.google.com/s2/favicons?domain=';
		$icon .= $url;

		$context = stream_context_create(
			['http' => ['header' => 'Connection: close']]);
		// E.g. http://www.google.com/s2/favicons?domain=xyz.com
		$file = file_get_contents($icon, false, $context);
		if ($file === false) {
			return null;
		}
		// TODO: transform into 16x16 png
		return $file;
	}
public function icon ( ) { $ url = $ this -> _stub [ 'website' ] ; if ( ! $ url ) { return null ; } $ pieces = parse_url ( $ url ) ; $ url = $ pieces [ 'host' ] ; $ icon = 'http://www.google.com/s2/favicons?domain=' ; $ icon .= $ url ; $ context = stream_context_create ( [ 'http' => [ 'header' => 'Connection: close' ] ] ) ; // E.g. http://www.google.com/s2/favicons?domain=xyz.com $ file = file_get_contents ( $ icon , false , $ context ) ; if ( $ file === false ) { return null ; } // TODO: transform into 16x16 png return $ file ; }
Returns a png img

@return string|null Resource content or null if not available
Returns a png img