Support » Plugin: Advanced Custom Fields: Image Crop Add-on » Jpeg compression of crops

  • Hello Anders,

    I was wondering if there was a way to set a jpg compression level to the crops your plugin applies ?

    It seems the crops are at 100% compression, so no compression at all. I usually set my images at 60%. It makes a huge difference.

    Thank you !

    Johan

    • This topic was modified 4 years, 3 months ago by jDelforge.
Viewing 4 replies - 1 through 4 (of 4 total)
  • I believe you can modify the jpeg compression level using acf-image-crop/image-quality filter. Default value seems to be 100.

    Thread Starter jDelforge

    (@jodelicious)

    Thanx @vodnar.

    I’ve looked in the files and indeed i saw the line.

    Pardon my ignorance, but how could i modify the parameter without touching the original file, so it does not get reset when updates happen ?
    Would u have some simple tips for me to add a modifier say in functions.php ?

    Thanx a bunch,

    Johan

    Try to put the following code into your theme’s function.php file, and replace the number 60 with the jpeg compression level you need:

    add_filter( 'acf-image-crop/image-quality', function( $level ) {
      return 60;
    });
    Thread Starter jDelforge

    (@jodelicious)

    Perfect @vodnar !

    Thank you & best regards from Belgium/Europa.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Jpeg compression of crops’ is closed to new replies.