PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.12.0
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.12.0
2.12.0 2.11.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.1 2.1.0 2.0.2 2.0.1 2.0.0 1.32.0 1.31.0 1.30.0 1.29.0 1.28.0 1.27.0 1.26.0 1.25.0 trunk All 53 releases
← All changes | includes/seo/class-oembed-manager.php +6 -4 2.8.0 → 2.12.0 View file →
@@ -300,15 +300,17 @@
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_url_to_postid($url);
304 + $attachment_id = Attachment_Lookup::id_from_url($url);
305 305
306 306 if ($attachment_id) {
307 - $meta = wp_get_attachment_image_src($attachment_id, 'full');
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);
308 310
309 - if (is_array($meta) && !empty($meta[1]) && !empty($meta[2])) {
310 - return [(int) $meta[1], (int) $meta[2]];
311 + if ($file['width'] > 0 && $file['height'] > 0) {
312 + return [$file['width'], $file['height']];
311 313 }
312 314 }
313 315
314 316 // An image hosted elsewhere cannot be measured without fetching it, so