I'm trying to take a pages og:image from a URL and add it to the media library and post meta. Works great until I hit a google user content url.
$image_url = ""
media_sideload_image( $image_url, $post_id, '', 'src' );
Results in "not valid image url". I would guess it has to do with how the google image url for og:image doesn't have any type of image extension on it. Is there a work around for this?
I'm trying to take a pages og:image from a URL and add it to the media library and post meta. Works great until I hit a google user content url.
$image_url = "https://lh3.googleusercontent/ApY_G9QDLuhi5pUrrHnUma72_MnSjP6ZN-N6qqRIpWARO-67CmGWsYB9vrTyIEbqm2SUcQ=w1200-h630-p"
media_sideload_image( $image_url, $post_id, '', 'src' );
Results in "not valid image url". I would guess it has to do with how the google image url for og:image doesn't have any type of image extension on it. Is there a work around for this?
I did a little searching and it looks like maybe you can fix it by appending ?.jpg
to the end of the URL. According to this guide that gets around most URL parsers