Title: Instagram URLs
Last modified: August 31, 2016

---

# Instagram URLs

 *  Resolved [PeterBP](https://wordpress.org/support/users/peterbp/)
 * (@peterbp)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/instagram-urls/)
 * Hi,
    I’ve had this working really well for over a year on a site. The client 
   has just informed that it has stopped though. Have updated the plugin but notice
   that it does seem to be working but the images are not getting into the media
   library due to corrupt URLS.
 * e.g. instead of 12677145_1691450861098121_180986696_n.jpg loading happily into
   the media library, the following attempts to and fails: 12677145_1691450861098121_180986696_n.
   jpg?ig_cache_key=MTE4MTUzNDM0MjYwMTgyMTEyOA%3D%3D.2
 * Any thoughts? Is this new caching by Instagram?
 * Thanks,
    Peter
 * [https://wordpress.org/plugins/ifttt-instagram-gallery/](https://wordpress.org/plugins/ifttt-instagram-gallery/)

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

 *  Thread Starter [PeterBP](https://wordpress.org/support/users/peterbp/)
 * (@peterbp)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/instagram-urls/#post-7096229)
 * Hi, fixed it myself by altering a function in class-ifttt-instagram-gallery.php
   to this, to lose the url query. Probably a cleaner way…
 *     ```
       public function load_instagram_image( $content_struct ) {
       		// Ingredients: Caption, Url, SourceUrl, CreatedAt, EmbedCode
       		$title          = htmlspecialchars( $content_struct['title'] );
       		$description    = $content_struct['description'];
       		$description_decoded = json_decode( $description, true ); 
   
       		$instagram_url  = $this->get_final_url( $description_decoded['Url'] );
       		$parts = parse_url($instagram_url);
       		$instagram_url = $parts['scheme'].'://'.$parts['host'].$parts['path'];
   
       		$image_url      = $this->get_final_url( $description_decoded['SourceUrl'] );
       		$parts			= parse_url($image_url);
       		$image_url	= $parts['scheme'].'://'.$parts['host'].$parts['path'];		
   
       		$filename       = $this->get_filename( $image_url );
       		$parts			= parse_url($filename);
       		$filename	= $parts['scheme'].'://'.$parts['host'].$parts['path'];		
   
       		$response       = wp_remote_get( $image_url );
       		$bits = $response['body'];
       		$this->upload_image( $filename, $title, $bits, $instagram_url );
       		$this->remove_old_images();
       	}
       ```
   
 *  Plugin Author [bjoerne](https://wordpress.org/support/users/bjoerne/)
 * (@bjoerne)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/instagram-urls/#post-7096231)
 * [@peterbp](https://wordpress.org/support/users/peterbp/): Thanks for your code.
   I released a new version yesterday. Your code helped me a lot and the problem
   should be fixed now.
 *  [gnfb](https://wordpress.org/support/users/gnfb/)
 * (@gnfb)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/instagram-urls/#post-8606643)
 * {“Url”: {{Url}}”, “SourceUrl”:” {{SourceUrl}}”}
 * Is this correct or has it changed as its still up on the site
 *  [gnfb](https://wordpress.org/support/users/gnfb/)
 * (@gnfb)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/instagram-urls/#post-8606677)
 * Dont worry I came across an easier option for my needs
    1. Use pinterest to select
   instgram images you want and post them to a pinterest board 2. use [Pinterest Importer](https://wordpress.org/plugins/pinterest-importer/)
   to upload the images to your website 3. add the images to [Contest Gallery](https://wordpress.org/plugins/contest-gallery/)
   Clunky but works

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

The topic ‘Instagram URLs’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/ifttt-instagram-gallery_cac8ba.svg)
 * [IFTTT Instagram Gallery](https://wordpress.org/plugins/ifttt-instagram-gallery/)
 * [Support Threads](https://wordpress.org/support/plugin/ifttt-instagram-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/ifttt-instagram-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ifttt-instagram-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ifttt-instagram-gallery/reviews/)

## Tags

 * [ifttt](https://wordpress.org/support/topic-tag/ifttt/)

 * 4 replies
 * 3 participants
 * Last reply from: [gnfb](https://wordpress.org/support/users/gnfb/)
 * Last activity: [9 years, 4 months ago](https://wordpress.org/support/topic/instagram-urls/#post-8606677)
 * Status: resolved