Join the Soledad Facebook Users Group here
for Share, assistance, discussion, and Updates related to Soledad WordPress Theme.

If you can't create a new ticket - you can send us an email via our contact form and we will get back to you.

Okay
  Public Ticket #3376509
disable auotmatic image compression of wordpress
Closed

Comments

  • maverick728 started the conversation

    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.


  • maverick728 replied

    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

  •  2,485
    PenciDesign replied

    Hi,

    Please add the following code to your site:

    add_filter( 'jpeg_quality', 'disable_img_compression' );
    function disable_img_compression() {
    return 100;
    }

    Regards,
    PenciDesign.


  • maverick728 replied

    thank you for the code. let me try

  • maverick728 replied

    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?

  • maverick728 replied

    The original file (looks clear)



    5860490584.png

    After uploading the same file it becomes hazzy and also the resolution changes when i select full image to display

    4532624970.png

    9044137028.png

    Just giving you some more info if that can be of some help.
  •  2,485
    PenciDesign replied

    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.


  • maverick728 replied

    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.



  • maverick728 replied

    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.



  • maverick728 replied

    you can close the case now. thank you