private static find_wp_dimensions ( string $size ) : false | array | ||
$size | string | the image size to search for can be WordPress-defined ("medium") or user-defined ("my-awesome-size") |
return | false | array | { @type int w @type int h } |
private static function find_wp_dimensions($size)
{
global $_wp_additional_image_sizes;
if (isset($_wp_additional_image_sizes[$size])) {
$w = $_wp_additional_image_sizes[$size]['width'];
$h = $_wp_additional_image_sizes[$size]['height'];
} else {
if (in_array($size, array('thumbnail', 'medium', 'large'))) {
$w = get_option($size . '_size_w');
$h = get_option($size . '_size_h');
}
}
if (isset($w) && isset($h) && ($w || $h)) {
return array('w' => $w, 'h' => $h);
}
return false;
}