# Media

The media object represents an object in a product.media array.

The `media` object represents an object in a [product.media](https://developer.versacommerce.de/articles/liquid-objects-product#product-media) array. It is an abstract object that can represent these object types:

- [image](https://developer.versacommerce.de/articles/liquid-objects-image)
- model
- [video](https://developer.versacommerce.de/articles/liquid-objects-video)
- [external_video](https://developer.versacommerce.de/articles/liquid-objects-external-video)

Use [media filters](https://developer.versacommerce.de/articles/liquid-filters-media-filters) to create URLs and model viewer tags that render the media on the product page.

> **Note:** In VersaCommerce `product.media` currently contains only images (it is an alias of `product.images`). Videos and 3D models are not returned through `product.media`.

The `media` object has the following attributes. Attributes that are specific to a media type are also available; see the reference of each supported object type.

## media.alt

Returns the alt text of the media, set on the products page in the admin.

## media.id

Returns the ID of the media.

## media.media_type

Returns the media type of the object.

Use `media_type` to filter the `product.media` array for all media of a given type.

```liquid
{% assign images = product.media | where: "media_type", "image" %}
{% for image in images %}
  {{ image.alt }}
{% endfor %}
```

```text
Image of the black stroller
Image of the grey stroller
```

## media.position

Returns the position of the media object in the `media` array of the `product` object.

## media.preview_image

Returns a [preview image](https://developer.versacommerce.de/articles/liquid-objects-image) for the media.

Preview images have no ID attribute.
