IMAGE

Access your image data.

The IMAGE function creates Image fields in your data source. Image fields display images in tables. Use this to show product images, video thumbnails, and other graphical information in your reports.

In this article:

Syntax

 IMAGE(Image URL, [Alternative Text])

 

Parameters:

  • Image URL - a field or expression that evaluates to a URL.
  • Alternative Text - (optional) a field or expression that evaluates to Text.

How the IMAGE function works

The IMAGE function takes a URL as input. The URL parameter can come from existing URL fields in the data source, or the parameter can be an expression that builds URLs from other fields and functions. 

The optional Alternative Text parameter provides the the image's alt text, which can be used by screen readers to assist vision-impaired users.

To display images in a report, add the Image field created by the IMAGE function to a table in your report. The size of the image displayed depends on the width of the column containing the image. If the URL is incorrect, or the image type is not supported, a broken image icon is displayed instead.

The Type drop-down menu is disabled for Image fields.

IMAGE examples

Display YouTube thumbnails

  1. Edit your YouTube Analytics data source
  2. Create a calculated field (for example, Thumbnail)
  3. Use this formula to create an Image field:
IMAGE(CONCAT('https://i.ytimg.com/vi/', External Video Id, '/hqdefault.jpg') , Video Title)
  1. Add the Thumbnail field as a dimension in a table:

Example table showing images displayed using the IMAGE function

Create clickable images with HYPERLINK

The images displayed in Image fields are static, but you can generate clickable images by providing an Image field as the Link Label parameter to the HYPERLINK function.

Limits of the IMAGE function

Images in tables only

Image fields only work in tables. If you change the visualization type, any Image fields in the chart will be ignored, or the image URL will appear as the dimension value.

Images and your data

In addition to the name of a file you want view, hyperlinks and image URLs can also send information, in the form of query parameters appended to the URL path. For example:

http://some.domain.com/a/b/c/somefile.jpg?foo=bar&baz=bat

This URL is requesting the JPEG image somefile.jpg. It is also sending data via the foo and bar parameters.

When reports or data sources contain hyperlinks or image URLs, you should make sure that these point to trusted domains, and that any additional data being sent makes sense to you.

To help with this, images in Data Studio have the following limits:

Images and the data control

When a report includes a data control, images appear when:

  • the data control is showing the default data set
  • the data control is showing a different (non-default) data set AND the Image field is serving images from a trusted domain. Currently, this includes most Google domains.

If the data control is showing a different (non-default) data set AND images are requested from an untrusted domain, images won't appear. Instead, the table will display the image URL. Report viewers can click the URL to view the image, and are shown a dialog asking them to make sure the link goes to a trusted domain.

Images in copied data sources

When you copy a data source, all Image fields are disabled in the copy. You can re-enable images by doing the following:

  1. Edit the data source
  2. For each field you want to enable, click More menu
  3. Select Enable.

Enable a data source field.

 

Was this article helpful?
How can we improve it?