AMP_Image_Dimension_Extractor::process_fetched_images PHP Метод

process_fetched_images() приватный статический Метод

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
private static process_fetched_images ( array $urls_to_fetch, array $images, array &$dimensions, integer $transient_expiration )
$urls_to_fetch array List of image urls that were fetched and transient names corresponding to each (for unlocking semaphore, setting "real" transient).
$images array Results of remote fetch mapping fetched image url to dimensions.
$dimensions array Map of image url to dimensions to be updated with results of remote fetch.
$transient_expiration integer Duration image dimensions should exist in transient/cache.
    private static function process_fetched_images($urls_to_fetch, $images, &$dimensions, $transient_expiration)
    {
        foreach ($urls_to_fetch as $url_data) {
            $image_data = $images[$url_data['url']];
            if (self::STATUS_IMAGE_EXTRACTION_FAILED === $image_data['size']) {
                $dimensions[$url_data['url']] = false;
                set_transient($url_data['transient_name'], self::STATUS_FAILED_LAST_ATTEMPT, $transient_expiration);
            } else {
                $dimensions[$url_data['url']] = array('width' => $image_data['size'][0], 'height' => $image_data['size'][1]);
                set_transient($url_data['transient_name'], array($image_data['size'][0], $image_data['size'][1]), $transient_expiration);
            }
            delete_transient($url_data['transient_lock_name']);
        }
    }