Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

Change Image Quality

To change the image quality of images added to your Envira Galleries:

  1. Add the following code to a new file at wp-content/plugins/envira-image-quality.php:
  2. <?php
    /**
    * Plugin Name: Envira Gallery - Image Quality
    * Plugin URI: https://enviragallery.com
    * Version: 1.0
    * Author: Envira Gallery Team
    * Author URI: https://enviragallery.com
    * Description: Override the default image quality when resizing and cropping images
    */
    /**
    * Override the default image quality when resizing and cropping images
    *
    * @param array $args Arguments
    * @return array Arguments
    */
    function envira_image_quality( $args ) {
    	
    	// Either set the value explicitly, or call your custom function which returns the quality value
    	$args['quality'] = 80;
    	
    	return $args;
    	
    }
    add_filter( 'envira_gallery_crop_image_args', 'envira_image_quality' );
    
  3. Navigate to the WordPress admin » Plugins and activate the Envira Gallery – Image Quality plugin