Skip to content

Image Criterion

The Image Search Criterion searches for image by specified image attributes.

Arguments

  • fieldDefIdentifier - string representing the identifier of the field
  • imageCriteriaData - array representing image attributes. All attributes are optional.

Limitations

Image can be used on all search engines.

Example

PHP

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
$imageCriteriaData = [
    'mimeTypes' => [
       'image/png',
    ],
    'orientation' => [
       'image/png',
    ],
    'width' => [
        'min' => 0, // (default: 0, optional)
        'max' => 1000, // (default: null, optional)
    ],
    'height' => [
        'min' => 0, // (default: 0, optional)
        'max' => 1000, // (default: null, optional)
    ],
    'size' => [
        'min' => 0, // (default: 0, optional)
        'max' => 2, // (default: null, optional)
    ],
];
$query->query = new Criterion\Image('image', $imageCriteriaData);

REST API

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
<Query>
   <Filter>
      <ImageCriterion>
         <fieldDefIdentifier>image</fieldDefIdentifier>
         <mimeTypes>image/png</mimeTypes>
         <size>
            <min>0</min>
            <max>2</max>
         </size>
         <width>
            <min>100</min>
            <max>1000</max>
         </width>
         <height>
            <min>500</min>
            <max>1500</max>
         </height>
         <orientation>portrait</orientation>
      </ImageCriterion>
   </Filter>
</Query>
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
    "ViewInput": {
        "identifier": "ImageCriterionTest",
        "Query": {
            "Filter": {
                "ImageCriterion": {
                    "fieldDefIdentifier": "image",
                    "mimeTypes": "image/png",
                    "size": {
                        "max": 1.5
                    },
                    "width": {
                        "max": 1000
                    },
                    "height": {
                        "max": 1500
                    },
                    "orientation": "portrait"
                }
            }
        }
    }
}

OR

{
    "ViewInput": {
        "identifier": "ImageCriterionTest",
        "Query": {
            "Filter": {
                "ImageCriterion": {
                    "fieldDefIdentifier": "image",
                    "mimeTypes": [
                       "image/png",
                       "image/jpeg"
                    ],
                    "size": {
                       "min": 0,
                       "max": 2
                    },
                    "width": {
                       "min": 100,
                       "max": 1000
                    },
                    "height": {
                       "min": 500,
                       "max": 1500
                    },
                    "orientation": [
                       "portrait",
                       "landscape"
                    ]
                 }
            }
        }
    }
}