Photo Field Type | Yext Hitchhikers Platform

The Photo field type allows you to store photos directly on your entities. This type is available for use in custom fields and custom field types.

Properties

The Photo field type is composed of the following five properties:

Property Description
width The width of the photo in pixels.
height The height of the photo in pixels.
url The Yext-Hosted URL of the file.
sourceUrl Source URL of the file. Only populates if uploaded by providing a hosted URL.
thumbnails (Legacy) A legacy feature generating thumbnails of various sizes for a photo upon upload. This functionality has been replaced by dynamic image transformation.

Validation

You can configure validation for Photo custom fields and Photo custom field types.

Option Available Validation Default Accepted Values
Width Set the minimum width in pixels 0 Whole numbers 0-1,000
Height Set the minimum height in pixels 0 Whole numbers 0-1,000
Aspect Ratio Set the accepted ratio of width to height Unconstrained Unconstrained, 1:1, 4:3, 3:2, 5:3, 16:9, 3:1,2:3, 5:7, 4:5, 16:10

Limitations

Option Accepted Values
Image size Up to 100 megapixels
Image format JPEG, PNG, BMP, GIF, TIFF, WEBP

Uploading Photos

Photos can be uploaded using all interfaces for editing enitities in Yext Content:

  • Entity Edit
  • Entity Upload
  • Connectors
  • API
  • Configuration as Code

All interfaces support photo uploads by referencing a source URL. Uploading a photo from a local file system is only supported in Entity Edit.

To upload a photo that is hosted online, populate the photo URL in the url property. This URL will then be propagated to the sourceUrl property, while the URL field will be the Yext-hosted URL of the photo.

Updating Photos

To change the photo that is being stored in a given Photo field, update the value of the url property to be the new hosted photo’s URL. Sending updates directly to the sourceUrl property is not supported.

Accessing Photos

Once an image has been uploaded to Content, its hosted URL is kept as a reference in the entity’s field. You can access the entity via API to retrieve the photo’s URL directly, for example:

With other fields elided, the response looks like this:

{
  "response": {
    "entities": [{
      "photoGallery": [{
        "image": {
"width": 314,
"height": 366, 
"url": "http://a.mktgcdn.com/p/Oua5ocwC7euaUFkJ-V8n3OpF76Xtfh_rdsDT9ki_laY/314x366.jpg"
      }]
    }]
  }
}

Every image is assigned a long UUID (the long random string above), so the URL has the form: a.mktgcdn.com/p/UUID/WIDTHxHEIGHT.EXT.

Both HTTP and HTTPS are supported.