| @@ -1842,12 +1842,8 @@ | ||
| 1842 | 1842 | $image_id = get_post_thumbnail_id($post); |
| 1843 | 1843 | if ($image_id) { |
| 1844 | 1844 | $image_data = wp_get_attachment_image_src($image_id, 'large'); |
| 1845 | 1845 | if (!empty($image_data[0])) { |
| 1846 | - // The ID is in hand here and gone once this returns a | |
| 1847 | - // bare URL; say so rather than have the tag builders look | |
| 1848 | - // it up again, twice, with a URL core cannot match (#847). | |
| 1849 | - Attachment_Lookup::remember((string) $image_data[0], (int) $image_id); | |
| 1850 | 1846 | return $image_data[0]; |
| 1851 | 1847 | } |
| 1852 | 1848 | } |
| 1853 | 1849 | } |
| @@ -1894,12 +1890,8 @@ | ||
| 1894 | 1890 | $image_id = get_post_thumbnail_id($post); |
| 1895 | 1891 | if ($image_id) { |
| 1896 | 1892 | $image_data = wp_get_attachment_image_src($image_id, 'large'); |
| 1897 | 1893 | if (!empty($image_data[0])) { |
| 1898 | - // The ID is in hand here and gone once this returns a | |
| 1899 | - // bare URL; say so rather than have the tag builders look | |
| 1900 | - // it up again, twice, with a URL core cannot match (#847). | |
| 1901 | - Attachment_Lookup::remember((string) $image_data[0], (int) $image_id); | |
| 1902 | 1894 | return $image_data[0]; |
| 1903 | 1895 | } |
| 1904 | 1896 | } |
| 1905 | 1897 | } |
| @@ -2192,23 +2184,21 @@ | ||
| 2192 | 2184 | if (empty($image_url)) { |
| 2193 | 2185 | return $image_data; |
| 2194 | 2186 | } |
| 2195 | 2187 | |
| 2196 | - // Get image metadata. The dimensions are those of the file this URL | |
| 2197 | - // names — usually a generated size — not of the original upload, so | |
| 2198 | - // the width and height published beside it describe the same image. | |
| 2199 | - $attachment_id = Attachment_Lookup::id_from_url($image_url); | |
| 2188 | + // Get image metadata | |
| 2189 | + $attachment_id = attachment_url_to_postid($image_url); | |
| 2200 | 2190 | if ($attachment_id) { |
| 2201 | 2191 | $image_meta = wp_get_attachment_metadata($attachment_id); |
| 2202 | 2192 | $image_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true); |
| 2203 | - $image_file = Attachment_Lookup::describe($attachment_id, $image_url); | |
| 2193 | + $mime_type = get_post_mime_type($attachment_id); | |
| 2204 | 2194 | |
| 2205 | 2195 | if ($image_meta && isset($image_meta['width'], $image_meta['height'])) { |
| 2206 | - $width = $image_file['width']; | |
| 2207 | - $height = $image_file['height']; | |
| 2196 | + $width = (int) $image_meta['width']; | |
| 2197 | + $height = (int) $image_meta['height']; | |
| 2208 | 2198 | |
| 2209 | 2199 | $image_data['alt'] = $image_alt ?: ''; |
| 2210 | - $image_data['type'] = $image_file['type']; | |
| 2200 | + $image_data['type'] = $mime_type ?: ''; | |
| 2211 | 2201 | |
| 2212 | 2202 | // SVGs and other vector uploads store 0x0 metadata. Dimension |
| 2213 | 2203 | // checks are meaningless there and dividing by 0 is fatal. |
| 2214 | 2204 | if ($width > 0 && $height > 0) { |
| @@ -2260,9 +2250,8 @@ | ||
| 2260 | 2250 | $custom_logo_id = get_theme_mod('custom_logo'); |
| 2261 | 2251 | if ($custom_logo_id) { |
| 2262 | 2252 | $logo_data = wp_get_attachment_image_src($custom_logo_id, 'large'); |
| 2263 | 2253 | if ($logo_data) { |
| 2264 | - Attachment_Lookup::remember((string) $logo_data[0], (int) $custom_logo_id); | |
| 2265 | 2254 | return $logo_data[0]; |
| 2266 | 2255 | } |
| 2267 | 2256 | } |
| 2268 | 2257 | |
| @@ -2270,9 +2259,8 @@ | ||
| 2270 | 2259 | $site_icon_id = get_option('site_icon'); |
| 2271 | 2260 | if ($site_icon_id) { |
| 2272 | 2261 | $icon_data = wp_get_attachment_image_src($site_icon_id, 'large'); |
| 2273 | 2262 | if ($icon_data) { |
| 2274 | - Attachment_Lookup::remember((string) $icon_data[0], (int) $site_icon_id); | |
| 2275 | 2263 | return $icon_data[0]; |
| 2276 | 2264 | } |
| 2277 | 2265 | } |
| 2278 | 2266 | |
| @@ -3029,14 +3017,13 @@ | ||
| 3029 | 3017 | return $validation; |
| 3030 | 3018 | } |
| 3031 | 3019 | |
| 3032 | 3020 | // Get image metadata if it's a local attachment |
| 3033 | - $attachment_id = Attachment_Lookup::id_from_url($image_url); | |
| 3021 | + $attachment_id = attachment_url_to_postid($image_url); | |
| 3034 | 3022 | if ($attachment_id) { |
| 3035 | 3023 | $image_meta = wp_get_attachment_metadata($attachment_id); |
| 3036 | - $image_file = Attachment_Lookup::describe($attachment_id, $image_url); | |
| 3037 | - $meta_width = $image_file['width']; | |
| 3038 | - $meta_height = $image_file['height']; | |
| 3024 | + $meta_width = isset($image_meta['width']) ? (int) $image_meta['width'] : 0; | |
| 3025 | + $meta_height = isset($image_meta['height']) ? (int) $image_meta['height'] : 0; | |
| 3039 | 3026 | |
| 3040 | 3027 | // SVGs and other vector uploads store 0x0 metadata — skip the |
| 3041 | 3028 | // dimension/ratio checks instead of dividing by 0. |
| 3042 | 3029 | if ($image_meta && $meta_width > 0 && $meta_height > 0) { |