Try for free

imgix Filters and Actions

Filters

media-cloud/imgix/enabled

Returns if the imgix, specifically, is enabled.

$enabled = apply_filters('media-cloud/imgix/enabled', false);

media-cloud/imgix/alternative-formats/enabled

Returns if alternative formats are enabled for imgix.

$enabled = apply_filters('media-cloud/imgix/alternative-formats/enabled', false);

media-cloud/imgix/detect-faces

Returns if imgix face detection is enabled.

$enabled = apply_filters('media-cloud/imgix/detect-faces', false);

media-cloud/imgix/render-pdf

Returns if imgix PDF rendering is enabled.

$enabled = apply_filters('media-cloud/imgix/render-pdf', false);

media-cloud/dynamic-images/filter-parameters

Allows dynamic image parameters to be changed.

add_filter('media-cloud/dynamic-images/filter-parameters', function($parameters, $imageSize, $attachmentId, $attachmentMeta) {
    if ($imageSize == 'some-size') {
        $parameters['fit'] = 'crop';
    }

    return $parameters;
}, 1000, 4);

Actions

media-cloud/imgix/setup

This action is triggered once the Imgix feature is configured and ready to use. This will not be triggered if the tool is not enabled.

add_action('media-cloud/imgix/setup', function() {
    // Imgix is setup and ready
});