function wpcom_amp_extract_image_dimensions_from_getimagesize($dimensions, $url) { if (is_array($dimensions)) { return $dimensions; } if (!function_exists('require_lib')) { return false; } require_lib('wpcom/imagesize'); $size = wpcom_getimagesize($url); if (!is_array($size)) { return false; } return array($size[0], $size[1]); }
function wpcom_amp_getimagesize($url) { if (!function_exists('require_lib')) { return false; } require_lib('wpcom/imagesize'); $size = wpcom_getimagesize($url); if (!is_array($size)) { return false; } return array($size[0], $size[1]); }
function wpcom_amp_extract_image_dimensions_from_getimagesize($dimensions) { if (!function_exists('require_lib')) { return $dimensions; } require_lib('wpcom/imagesize'); foreach ($dimensions as $url => $value) { if (is_array($value)) { continue; } $result = wpcom_getimagesize($url); if (is_array($result)) { $dimensions[$url] = array('width' => $result[0], 'height' => $result[1]); } } return $dimensions; }