Envira Gallery Documentation
Documentation, Reference Materials and Tutorials for Envira Gallery
Documentation, Reference Materials and Tutorials for Envira Gallery
Would you like to remove the default image compression that WordPress applies to your uploaded images? WordPress automatically applies image compression to each image uploaded to your site. This tutorial will walk you through how to turn off image compression with the use of a plugin we will create.
To remove WordPress Image Compression, just add the following code to a new file at wp-content/plugins/envira-remove-wordpress-image-compression.php
.
<?php /** * Plugin Name: Envira Gallery - Remove WordPress Image Compression * Plugin URI: https://enviragallery.com * Version: 1.0 * Author: Envira Gallery Team * Author URI: https://enviragallery.com * Description: This will remove the compression WordPress applies to images when uploading to your media library */ /** * Override the default image quality when resizing and cropping images */ add_filter('jpeg_quality', function($arg){return 100;});
If you’re unsure how to create a plugin file, follow these steps below:
envira-remove-wordpress-image-compression.php
.Your next step is to activate the plugin you just uploaded. Simply navigate to the Plugins from within your WordPress dashboard and activate the Envira Gallery – Remove WordPress Image Compression plugin.
After activating, any new image uploaded will no longer be subject to WordPress’ image compression!
That’s it! Would you like to extend Envira further? Check out our tutorial on how to Remove Fragment Cache from Envira Gallery.