When I upload a featured image in WordPress, it decreases the size of image. The quality of images is also much lower than original images. How can I get WordPress to have larger, higher-quality featured images?
Leave a Reply
You must be logged in to post a comment.
Here You can give the size of thumbnails in parameter of
get_the_post_thumbnail()
function in array like this:You can change the size of your thumbnail images under Settings > Media.
As for the quality of the image, you can adjust how much jpeg compression (assuming you’re using jpegs) wordpress uses when shrinking your original image down to thumbnail size. Add the following to your functions.php file.
add_filter( 'jpeg_quality', create_function( '', 'return 90;' ) );
You can crank that 90 right up to 100 if you like, but you will end up with larger image file sizes.
Note that this only affects any new images you upload to the site â i.e., WordPress won’t automatically re-save thumbnail (and Medium and Large if applicable) version of all the images you’ve already uploaded. But you can force regeneration of thumbnail images with a plugin like… wait for it… Regenerate Thumbnails. It’s also especially handy if you’ve just changed your image sizes in the Media settings. I use this plugin all the time. It’s pretty rad.
Yo can define new image sizes with these:
And then you can use it in your theme with these: