How to Change the quality of your WordPress thumbnails images.

Thumbnails is very popular word in wordpress. The function creates different size of images for our wordpress site. Post Thumbnails is a theme feature was introduced with Version 2.9. It was quickly changed to Featured Images with Version 3.0. Thumbnail, now Featured Image, is an image that is chosen as the representative image for Posts, Pages or Custom Post Types. The display of this image is up to the theme. This is especially useful for “magazine-style” themes where each post has an image.

Some times we are facing issues with our thumbnail images that has been generated my wordpress. It may has low quality or heavier to download. When we are uploading any images through admin uploader, wordpress by default set 90% quality to the generated images. If you think that your cropped thumbnails don’t have a good enough quality? or it is much heavier to download ?. Here is solution to overcome from this type of situation.

The following code will help you to increase or decrease the thumbnail image quality of or generated images.
Just add the code to the theme function.php file.


/*  Set custom thumbnail quality ------------ */
function crayon_thumbnail_quality( $quality ) {
    return 100;
}
add_filter( 'jpeg_quality', 'crayon_thumbnail_quality' );
add_filter( 'wp_editor_set_quality', 'crayon_thumbnail_quality' );

Change value to anything you want. 95 would be the default max quality. The code also work any new version of wordpress.

Enjoy WordPress!!!

Comments

  1. I’m gone to inform my little brother, that he should also go to see this website on regular basis to get updated from most up-to-date news update.

Leave a Comment