Docs    Instagram    Documentation

How Does Image Resizing and Optimization Work?

The image files that come from Instagram’s API are a very large 1080 pixel resolution. To optimize the size of the images in your feed and keep your site loading as quick as possible, both the free and pro versions of Instagram Feed have an image resizing and local storage system.

When Are Images Created?

The first time a new post appears in your feed, the plugin uses an AJAX call to trigger the resizing of the image on your site’s server. Two sizes are created, a 640 and 320 pixel resolution version. All future page loads will use the local image files based on the actual size of the images in the feed.

Where Are Images Stored?

The local image files are stored in the uploads directory of your WordPress files in a folder labeled “sb-instagram-feed-images.” Two custom database tables are also created in your WordPress database with the names “sbi_instagram_feeds_posts” and “sbi_instagram_posts.” These are used to track which posts have images created for them and where the posts are located.

Are There Any Limits to How Many Images Are Stored?

The free version of the plugin stores a maximum of 350 posts worth of images while the pro version stores up to 1500 posts worth. Once the limit is reached, the image file that is displayed on your site the least frequently will be deleted before new images are created. You can manually change the maximum number of records by defining the constant that controls this in your wp-config.php file. For example:

define( 'SBI_MAX_RECORDS', 1000 );

The plugin also limits how many new images can be created in a short period of time. The plugin will disable image resizing if more than 100 new image files are created within 15 minutes. This is meant to prevent potential issues with your server.

When Will the Plugin Use Images From a CDN?

Here are circumstances where you will see image files used from Instagram’s CDN:

  • The post has not been displayed in the feed before (will change once resizing is complete)
  • Images are smaller than 150 pixels wide in the feed (a special redirect method is used to get 150 pixel images from Instagram’s CDN)
  • The post is displayed in the lightbox (full 1080 pixel resolution images are used)
  • There was an error loading the local image file

If you are still seeing images sourced from Instagram’s CDN and none of these apply, there may be an error during the resizing process. The resizing process requires that Imagick is installed on the server your site is hosted on. You may need to contact your host to see if there are any issues with Imagick.

Can the Plugin Only Use Local Images When the Page Loads?

If you would like to prevent the use of CDN images as much as possible, you can enable the setting “Favor Local Images” found on the “Customize” tab, “Advanced” area. You can also use background caching to resize images when new posts are retrieved using WordPress Cron. See our guide for GDPR compliance for more explanation.

Can I Disable Image Resizing?

Yes, to disable Image Resizing, go to WordPress Dashboard > Instagram Feed > Settings > Advanced, disable Optimize Images, and click Save Changes. You can also clear the existing images and records by clicking the Reset button to the right of the Optimize Images setting.

What Other Features use the Image Resizing System?

  • Local versions of avatar images are also created and stored for use in the feed.
  • For the pro version, recent hashtag feeds rely on the image resizing system to display posts made more than 24 hours ago.
support

Couldn’t find your answer in the docs?

Contact Support

Was this article helpful?