PHP Class AMP_Image_Dimension_Extractor, amp-wp

Show file Open project: Automattic/amp-wp Class Usage Examples

Public Properties

Property Type Description
$callbacks_registered

Public Methods

Method Description
extract ( $urls )
extract_by_downloading_images ( array $dimensions, string $mode = 'concurrent' ) : array Extract dimensions from downloaded images (or transient/cached dimensions from downloaded images)
get_default_user_agent ( ) : string Get default user agent
normalize_url ( $url )

Private Methods

Method Description
determine_which_images_to_fetch ( array &$dimensions, array &$urls_to_fetch ) Determine which images to fetch by checking for dimensions in transient/cache.
fetch_images ( array $urls_to_fetch, array &$images, string $mode ) Fetch dimensions of remote images
fetch_images_via_fast_image ( array $urls_to_fetch, array &$images ) Fetch images via FastImage library
fetch_images_via_faster_image ( array $urls_to_fetch, array &$images ) Fetch images via FasterImage library
process_fetched_images ( array $urls_to_fetch, array $images, array &$dimensions, integer $transient_expiration ) Determine success or failure of remote fetch, integrate fetched dimensions into url to dimension mapping, cache fetched dimensions via transient and release/delete semaphore transient
register_callbacks ( )

Method Details

extract() public static method

public static extract ( $urls )

extract_by_downloading_images() public static method

Extract dimensions from downloaded images (or transient/cached dimensions from downloaded images)
public static extract_by_downloading_images ( array $dimensions, string $mode = 'concurrent' ) : array
$dimensions array Image urls mapped to dimensions.
$mode string Whether image dimensions should be extracted concurrently or synchronously.
return array Dimensions mapped to image urls, or false if they could not be retrieved

get_default_user_agent() public static method

Get default user agent
public static get_default_user_agent ( ) : string
return string

normalize_url() public static method

public static normalize_url ( $url )

Property Details

$callbacks_registered static public property

static public $callbacks_registered