Plug-In Bug and Fix
-
Hello –
Below is a fix for the plug-in no longer updating.
The issue I found:
Near Line 1362, where image extension is checked:
$image_info = pathinfo( $image_data[‘url’] );
$extension = $image_info[‘extension’];
Instagram added a query string to the image URL that’s contains the domain name of the CDN, this function returns ‘net’ and the image doesn’t get added to the media library.
This ought to work better:
if (preg_match(‘/\.(\w{3,4})(\?|$)/’, $image_data[‘url’], $matches))
{
$extension = $matches[1];
}The query string would ideally need to be removed from the image name also:
$base_img_name = preg_replace(‘/\?.*$/’, ”, $image_info[‘basename’]);
$attachment = array(
‘guid’ => $image_data[‘url’],
‘post_mime_type’ => ‘image/jpeg’,
‘post_title’ => $base_img_name,
‘post_excerpt’ => $image_data[‘caption’]
);-PS
The topic ‘Plug-In Bug and Fix’ is closed to new replies.