0

Whenever I upload a large image, it gets resized to the width of the post. This will be a negative feature for comic reading sites. I need to display the full width images, which I can resize when I need during upload.

If anything that can fix this issue?

  • 1
    When you say resized, are you saying that the image is being stretched to a new size, or that a new image of a different size has been show? Aka if you upload a 100x100 image, are you seeing a 200x200 image, or a 100x100 image stretched to 200x200? The distinction is important, one is stylesheet/css related, the other is UX/UI/PHP – Tom J Nowell May 16 '15 at 23:11
3

WordPress resizes its images into 3 default sizes:

  • Large (Default: 1024 × 1024)
  • Medium (Default: 300 × 300)
  • Thumbnail (Default: 150 × 150)

And in all the three cases WordPress simply crop them from middle by default, and make their different versions for different use cases. It's done to ensure speed.

When we call a featured image in somewhere we simply call the size inside the function like:

the_post_thumbnail( 'large' );

Okay, now the good news is, though WordPress resizes all the uploaded images, it keeps the original one intact, and we can use the original one too, wherever necessary. To use the original file, you just need to call:

the_post_thumbnail('full');

So, the problem is now on your theme file. You need to modify the theme file to change the code into something like this.

Disabling resizes

From admin panel

Though it's not related for your cause, but to stop those auto resizing, follow the simple steps:

  • In /wp-admin from Settings » Media
  • Now in Large, Medium and Thumbnail sizes, simply put zero (0) into their width and height.
  • Now Save changes.

It'll stop those resizes from the future uploads. :)

Using code

You can use remove_image_size() function into your functions.php to disable all the three default image sizes:

remove_image_size('large');
remove_image_size('medium');
remove_image_size('thumbnail');

It will stop resizing the images into those sizes.

Reference

  • 1
    Of note, the original size, aka 'full' is also an option when embedding an image in the post editor – Tom J Nowell May 16 '15 at 23:12
2

To disable resizing for all image sizes without manually removing each size with remove_image_size function, use the filter intermediate_image_sizes_advanced

/**
 * @param array $sizes    An associative array of image sizes.
 * @param array $metadata An associative array of image metadata: width, height, file.
 */
function remove_image_sizes( $sizes, $metadata ) {
    return [];
}
add_filter( 'intermediate_image_sizes_advanced', 'remove_image_sizes', 10, 2 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.