• 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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter psch

    (@psch)

    Also, I might suggest you handle the cron task differently. The duplication bug is exaggerated by the way the job is set up. It never completes the update, so the time stamp of next run doesn’t get updated – it ends up scraping on every page request. Static “once every 2 hours” would probably suffice.

    @psch Thank you for the input. Since the plugin is live I will take a look into it and implement your recommendation.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Plug-In Bug and Fix’ is closed to new replies.