Developer Tweaks for Easy Image Optimizer (ExactDN)

While the Easy Image Optimizer (powered by ExactDN) is designed to be pretty much automatic, it has a ton of filters and constants that will allow developers to customize it's behavior. If you're familiar with Jetpack's Photon module, you'll see pretty much all the same filters, and likely a few extras. Uppercase items are constants that should be defined in wp-config.php, lowercase items are filters that can be run elsewhere, like your functions.php. If you want more detail, they are fully documented in the class-exactdn.php file:

EXACTDN_CONTENT_WIDTH - ExactDN will honor the $content_width variable set by your theme for anything that goes through "the_content" filter. Usually, this is only applied to images in the actual post/page content, and images in headers, footers, etc. should be unaffected. But if you're using a page builder, you can do all sorts of clever things that bypass what your theme is configured to do. And you might just need to increase the content width:

define( 'EXACTDN_CONTENT_WIDTH', 1920 );

EXACTDN_EXCLUDE - By default, ExactDN rewrites URLs for all external resources: images, JS, CSS, fonts, etc. Valid values include a simple string, or an array of string pattern matches. Wildcards (*) are implied, so do not include them or you will get unexpected results. See examples.

EXACTDN_PREVENT_SRCSET_FILL - ExactDN will attempt to make all images "responsive" for mobile and hi-dpi/retina devices. Define this constant in your wp-config.php if the "srcset fill" is causing issues on your site.

EXACTDN_IMAGE_DOWNSIZE_SCALE - When explicit dimensions are given to the image_downsize() function, ExactDN will crop an image to those exact dimensions. If you prefer to have scaling be the default for such operations, define this to true in your wp-config.php.

EIO_DISABLE_DEEP_INTEGRATION - Completely disable the image_downsize() integration and rely on parsing the full HTML instead. Some plugins/themes can't handle getting a CDN URL from the core WordPress image functions, so this will resolve such issues.

EIO_PRESERVE_LINKED_IMAGES - ExactDN will rewrite image links to use the CDN, but will use lossy/premium compression by default. If you'd like your hyperlinks to display the original image with minimal compression, set this one to true.

exactdn_allowed_domains - ExactDN will attempt to determine which domains should be allowed for URL rewriting (for example, if you use WPML with sub-domains). If you need to change them, use this filter.

eio_allowed_background_image_elements - Filter the array/list of HTML elements that Easy IO will parse for CSS background images. Defaults to div, li, span, section, and a (link).

exactdn_content_width - Many themes define a global $content_width variable (in pixels), which ExactDN will use to constrain images found in page/post content, use this filter to override that global setting.

exactdn_full_align_image_width - Defaults to the larger of 1920 or the $content_width, used for full-width images in the block editor (Gutenberg).

exactdn_wide_align_image_width - Defaults to the larger of 1500 or the $content_width, used for wide-width images in the block editor (Gutenberg).

exactdn_full_align_bgimage_width - Defaults to 1920, used for full-width (CSS) background images in the block editor (Gutenberg).

exactdn_wp_cover_parallax_bgimage_width - Defaults to 1920, used for cover block (CSS background images) using parallax in the block editor (Gutenberg).

exactdn_wide_align_bgimage_width - Defaults to 1500, used for full-width (CSS) background images in the block editor (Gutenberg).

exactdn_et_parallax_bgimage_width - Defaults to 1920, used for Elementor background images using parallax.

exactdn_content_bgimage_width - Defaults to $content_width, used for all other CSS background images in the content.

exactdn_skip_image - Defaults to false, second parameter is usually the image url, third depends on whether it comes from the content filter, or the srcset filter.

exactdn_skip_page - Defaults to false, second parameter is the page URI. This is not the full URL, just the "path" like /2024/10/a-blog-i-wrote-about-horses/

exactdn_post_image_args - Filter the array of ExactDN arguments added to an image, which by default, only includes width and height values.

eio_add_missing_width_height_attrs - Override the addition of missing dimensions (though this can be found on the settings also).

exactdn_admin_allow_image_downsize - While themes and plugins generally use the image_downsize() function, the WP admin also uses it liberally, but ExactDN is turned off in the WP admin by default (false).

exactdn_override_image_downsize - Provide plugins a way of preventing ExactDN from being applied to images retrieved from WordPress Core. By returning true, the image_downsize filter will terminate immediately.

exactdn_image_downsize_string - Filter the ExactDN arguments added to an image when that image size is a string. For example, when $size is 'full', 'medium', etc.

exactdn_image_downsize_array - Filter the ExactDN arguments added to an image, when the image size is an array of height and width values.

exactdn_admin_allow_image_srcset - Provide plugins a way of running ExactDN for the srcset attribute of images in the WordPress Dashboard (wp-admin).

exactdn_srcset_multipliers - Filter the multipliers ExactDN uses to create new srcset items. Return false to short-circuit and bypass auto-generation.

exactdn_srcset_fill_width - Filter the width used to add additional images to the srcset (based on aforementioned multipliers). Will bypass srcset auto-fill if false is returned.

exactdn_reject_https - Tells ExactDN to ignore/reject images that are served via HTTPS. Defaults to false, set to true to only rewrite non-encrypted image communication.

exactdn_validate_image_url - Overwrite the results of the previous validation steps an image goes through to be considered valid for ExactDN.

exactdn_admin_allow_plugin_url - Defaults to false, can be used to allow processing of images from plugins in the wp-admin.

exactdn_development_mode - Disables ExactDN URL processing for local development. Defaults to false.

exactdn_skip_for_url - Allow specific image URls to avoid going through ExactDN (in case exactdn_skip_image didn't work for you).

exactdn_pre_image_url - Filter the original image URL before it goes through ExactDN.

exactdn_pre_args - Filter the ExactDN image parameters before they are applied to an image.

exactdn_the_page - Provides the ability to filter the HTML after Easy IO is done with it.

easyio_verification_schedule - Defaults to 'daily', can be any schedule registered with WordPress. Second parameter is the "event", something like 'easyio_verification_checkin'.

exactdn_version_string - Most JS/CSS resources that have no query string will have one auto-generated (for cache busting), but you can use this filter to override/bypass it.

Still need help? Contact Us Contact Us