Skip to content

Image Dimension Criterion

The Dimensions Search Criterion searches for image with specified dimensions.

Arguments

  • fieldDefIdentifier - string representing the identifier of the field
  • imageCriteriaData - an array representing minimum and maximum values for width and height, expressed in pixels

Limitations

ImageDimensions can be used on all search engines.

Example

PHP

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
$imageCriteriaData = [
    'width' => [
        'min' => 100, // (default: 0, optional)
        'max' => 1000, // (default: null, optional)
    ],
    'height' => [
        'min' => 500, // (default: 0, optional)
        'max' => 1500, // (default: null, optional)
    ],
];

$query->query = new Criterion\Dimensions('image', $imageCriteriaData);

REST API

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
<Query>
    <Filter>
        <ImageDimensionsCriterion>
            <fieldDefIdentifier>image</fieldDefIdentifier>
            <width>
                <min>100</min>
                <max>1000</max>
            </width>
            <height>
                <min>500</min>
                <max>1500</max>
            </height>
        </ImageDimensionsCriterion>
    </Filter>
</Query>
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
{
    "ViewInput": {
        "identifier": "ImageDimensionsCriterionTest",
        "Query": {
            "Filter": {
                "ImageDimensionsCriterion": {
                    "fieldDefIdentifier": "image",
                    "width": {
                        "min": 100,
                        "max": 1000
                    },
                    "height": {
                        "min": 500,
                        "max": 1500
                    }
                }
            }
        }
    }
}