| @@ -300,17 +300,15 @@ | ||
| 300 | 300 | * @param array $settings Social settings. |
| 301 | 301 | * @return array{0:int,1:int} Width and height; 0,0 when unknown. |
| 302 | 302 | */ |
| 303 | 303 | private function image_dimensions(string $url, array $settings): array { |
| 304 | - $attachment_id = Attachment_Lookup::id_from_url($url); | |
| 304 | + $attachment_id = attachment_url_to_postid($url); | |
| 305 | 305 | |
| 306 | 306 | if ($attachment_id) { |
| 307 | - // The file this URL names: a social image picked at a generated | |
| 308 | - // size is not as large as the upload it was cut from. | |
| 309 | - $file = Attachment_Lookup::describe($attachment_id, $url); | |
| 307 | + $meta = wp_get_attachment_image_src($attachment_id, 'full'); | |
| 310 | 308 | |
| 311 | - if ($file['width'] > 0 && $file['height'] > 0) { | |
| 312 | - return [$file['width'], $file['height']]; | |
| 309 | + if (is_array($meta) && !empty($meta[1]) && !empty($meta[2])) { | |
| 310 | + return [(int) $meta[1], (int) $meta[2]]; | |
| 313 | 311 | } |
| 314 | 312 | } |
| 315 | 313 | |
| 316 | 314 | // An image hosted elsewhere cannot be measured without fetching it, so |