You use wp_check_filetype to check and extract content type for remote file but this doesn’t work if image is send via a script page line php or perl. If url is http://a_url/image.php?imageid=15 your script doesn’t work. I use wp_remote_retrieve_headers to get correct content type.
In line 101 I comment $wp_filetype = wp_check_filetype($filename, null ); and substitute with
$response = wp_remote_get($imageurl);
$wp_filetype_h = wp_remote_retrieve_headers($response);
$wp_filetype = $wp_filetype_h[‘content-type’];
then I change all $wp_filetype[‘type’] with $wp_filetype
Hoping you can include this patch in next versions. Bye
- The topic ‘Patch to support url where filename is not an image name’ is closed to new replies.