post thumbnails - How to handle and keep image quality of featured image uploads

My idea is to use the uploaded thumbnailfeatured image from the post as a image with the height of 750px and 100% width

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;

            }

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;

            }
Share Improve this question asked Oct 4, 2019 at 20:10 FreddyFreddy 111 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 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;});
?>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745104967a4611503.html

相关推荐

  • post thumbnails - How to handle and keep image quality of featured image uploads

    My idea is to use the uploaded thumbnailfeatured image from the post as a image with the height of 750px and 100% width

    10小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信