Where in X can I reduce the number of different image sizes generated when uploading?

I have fallen foul of the Hostgator iNode limit due to the multiple number of images generated when I upload, currently I seem to be getting a ratio of 8 to 1.

I am currently getting 100x133, 113x150, 225x300, and 600x671 which are a total waste of iNodes.

From what I gather this is a “Theme feature” how do I reduce the number so I do not end up with Octuplicated images when I only want 2?

Thanks

Hi @Fairbanking

Adding this snippet in functions.php file in your child theme directory should get rid of the thumbnails sizes generated by X theme:

// Remove X Image Sizes
// =============================================================================
add_action('after_setup_theme', 'remove_x_image_sizes', 100000);
function remove_x_image_sizes() {
  remove_image_size('post-thumbnails');
  remove_image_size('entry');
  remove_image_size('entry-cropped');
  remove_image_size('entry-fullwidth');
  remove_image_size('entry-cropped-fullwidth');
}

If you don’t know how to create a child theme, then please follow this guide:

Thanks.

Thanks Alaa, but my desire is to have a Large image and an Actual Size image, in your code example will I not be removing the Actual size by "remove_image_size(‘entry’); "

Also, does this code stop the theme generating the images during the upload process before removing them? as a separate aspect of this problem with the iNodes is that too often I get a timeout, and failure when uploading, and had surmised that this was due to the multiple processing of each image.

Thanks for your help, I am trying your solution, but would appreciate your comments on the above.

Hi Fairbanking,

Yes, that is the main entry image. You can avoid removing that specific one.

The code that my colleague shared is the whole image generation process which is done via the theme. The rest is related to the WordPress itself.

You can go to Settings > Media to fine tune the image sizes there. Also, there are a bunch of good articles talking about the fact such as this one:

In general, I suggest that you consider this as the server point of view. I am not sure about the iNodes which you mentioned but a decent hosting service provider handles these multiple sizes of WordPress with no problem, so consider upgrading your server as in the future the lack of the sizes may cause your website to load needlessly big images for thumbnails and other parts of the website.

Thank you.

Thanks for the prompt response, as I mentioned at the beginning, I fell foul of Hostgator’s maximum 100,000 iNodes per plan which means if you generate 7 supplementary images for each one you fall foul of their T&Cs with 12,000 images. Which with 10 images per post factors down to 1,200 posts, not exactly a massive blog :frowning:
Thanks again

Hi Fairbanking,

I understand. Thank you for the information. So the methods I mentioned in my last reply will do the trick for you to reduce the iNode requests then.

Thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.