1

My idea is to use the uploaded thumbnail/featured image from the post as a image with the height of 750px and 100% width of the page on my page.

Everything is working fine however the image quality is very poor after I set the height to 750px.

My guess is when you upload the thumbnail somehow wordpress decompress the image to a lower quality because they expect it to be used for a small thumbnail.

Is there a way to keep the original image quality when uploaded as a featured image?

When displaying the image I'm attaching a simple class to make sure it has 750px height and 100% width:

   the_post_thumbnail( array('class' => ' responsiveThumbnail'));

css:

   .responsiveThumbnail  {

        width: 100%;
        height: 750px;
        margin: 0;

            }

1 Answer 1

2

Several things could be impacting the image quality, but the biggest impact is calling the_post_thumbnail() without giving it a size. By default that will get the "thumbnail" image size, which by default is 150x150 pixels.

Try this instead:

the_post_thumbnail('full', array('class' => ' responsiveThumbnail'));

Then you'll be pulling the full-size image rather than the autogenerated thumbnail.

If you're still not getting the quality you'd like after you confirm you're pulling full-sized images, check:

  • Plugins - some image plugins may adjust the image quality. You may want to disable any image-related plugins to see if it makes a difference.
  • Core image quality setting - Core itself compresses somewhat by default. You can override this with
<?php
add_filter('jpeg_quality', function($arg){return 100;});
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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