Follow up to #3432
The PHP function getimagesize doesn't work in a server where allow_url_fopen=0 and throws a warning
Warning: getimagesize(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in .../jetpack/functions.opengraph.php on line 353
Warning: getimagesize(http://xxx.xxx/wp-content/uploads/2016/05/cropped-pizza-1-270x270.png): failed to open stream: no suitable wrapper could be found in .../jetpack/functions.opengraph.php on line 353
OpenGraph: replace function getimagesize that doesn't work in an envi…
…ronment where allow_url_fopen=0. Use standard WP function instead.
Do you mean $max_size?
No. I meant to say side, because it will get the larger side.
should this be $width, $height?
no, it's to pass the same dimension passed when calling blavatar_url a few lines above, in line 324
Thanks Elio, looks good 👍 wp functions ftw
One note is that we are going to have to update wpcom files to use this as well. I don't see anything in here that is jetpack specific, so should be fine when it's all synced up.
…ronment where allow_url_fopen=0. Use standard WP function instead. (#5602)
Ported to branch-4.4 in 14ab7ec.
@eliorivero Blavatars are hosted remotely (on Gravatar), so calling attachment_url_to_postid with a Blavatar URL will always fail.
Since the code in this PR is already merged and released, I opened #6061 so we don't lose your comments. Let's continue the conversation there.
@eliorivero Instead of doing a reverse lookup using attachment_url_to_postid which can be very slow on big sites, can we just call get_option( 'site_icon' ) to get the id?
get_option( 'site_icon' )