Comments maverick728 started the conversationMay 23, 2023 at 7:29amHello,How can i disable automatic image compression on my website. I searched on google but could not fing the code in function.php file. wordpress compresses all the image files irrespective of the extension . jpg, webp etc. also can you recommend any other way to upload images in blogpost.please help. thanks for all the help in advance. maverick728 repliedMay 23, 2023 at 8:00amEDIT: this code given in that website is non sense. Any one reading this comment should not follow the code mentioned in that website.Following link provides some solution. But i dont know if that is advisable. hence asking for your advise https://www.megademic.com/how-to-stop-wordpress-compressing-jpg-images/ Something like: // Disable WordPress image compression add_filter( 'wp_editor_set_quality', function( $arg ) { return 100; }); I dont know 2,610PenciDesign repliedMay 23, 2023 at 8:06amHi,Please add the following code to your site: add_filter( 'jpeg_quality', 'disable_img_compression' ); function disable_img_compression() { return 100; }Regards,PenciDesign.maverick728 repliedMay 23, 2023 at 8:10amthank you for the code. let me trymaverick728 repliedMay 23, 2023 at 8:20amIm trying to upload web file. im still seeing that the image is getting compressed. Is it because the code mentions jpeg file and im uploading webp file?maverick728 repliedMay 23, 2023 at 8:37amThe original file (looks clear)After uploading the same file it becomes hazzy and also the resolution changes when i select full image to displayJust giving you some more info if that can be of some help. 2,610PenciDesign repliedMay 23, 2023 at 8:38amHi,After adding this code, you need to regenerate all the thumbnail image by install this plugin: https://wordpress.org/plugins/regenerate-thumbnails/Regards,PenciDesign.maverick728 repliedMay 23, 2023 at 1:07pmI dont understand regenerating all the image thumbnails. My apologies. What is this tool going to do about the new images which I will upload? will it resize all my images? i dont want to resize my previous images.FYI (just in case) : Im uploading new image after making the changes to function.php and after activating the plugin. but still the image is blured. please guide. Highly appreciate your help.maverick728 repliedMay 23, 2023 at 1:29pmone thing solved my issue for big images.I added following code in function.php file. ( to remove the max resolution cap)add_filter( 'big_image_size_threshold', '__return_false' );this stopped the wordpress to resize the image. now the image is clear. maverick728 repliedMay 23, 2023 at 1:29pmyou can close the case now. thank you Sign in to reply ...
Hello,
How can i disable automatic image compression on my website. I searched on google but could not fing the code in function.php file.
wordpress compresses all the image files irrespective of the extension . jpg, webp etc.
also can you recommend any other way to upload images in blogpost.
please help. thanks for all the help in advance.
EDIT: this code given in that website is non sense. Any one reading this comment should not follow the code mentioned in that website.
Following link provides some solution. But i dont know if that is advisable. hence asking for your advise
https://www.megademic.com/how-to-stop-wordpress-compressing-jpg-images/
Something like:
// Disable WordPress image compression
add_filter( 'wp_editor_set_quality', function( $arg ) {
return 100;
});
I dont know
Hi,
Please add the following code to your site:
Regards,
PenciDesign.
thank you for the code. let me try
Im trying to upload web file. im still seeing that the image is getting compressed.
Is it because the code mentions jpeg file and im uploading webp file?
The original file (looks clear)
Hi,
After adding this code, you need to regenerate all the thumbnail image by install this plugin: https://wordpress.org/plugins/regenerate-thumbnails/
Regards,
PenciDesign.
I dont understand regenerating all the image thumbnails. My apologies.
What is this tool going to do about the new images which I will upload? will it resize all my images? i dont want to resize my previous images.
FYI (just in case) : Im uploading new image after making the changes to function.php and after activating the plugin. but still the image is blured.
please guide. Highly appreciate your help.
one thing solved my issue for big images.
I added following code in function.php file. ( to remove the max resolution cap)
add_filter( 'big_image_size_threshold', '__return_false' );
this stopped the wordpress to resize the image. now the image is clear.
you can close the case now. thank you