Was this helpful?

Querying Media

Alpaca supports a wide range of media types. These include being able to access images, video and more.

Directly loading Media

Images, videos and other media are contained within the MediaResource type. You can load media resources when you have an id value, using the mediaResource field with the id as the argument.

1# Loads a media resource of type MediaImage
2
3query MediaImage {
4  # Use the mediaResource() to load MediaImage types
5  mediaResource(
6    # Supply your Media Resource ID
7    id: "media/ABC123"
8  ) {
9    # In this query, we are accessing the image
10    ... on MediaImage {
11      # Select a thumbnail from the image sources, based on the bestFit strategy
12      thumbnail: source(bestFit: [100, 50]) {
13        url
14      }
15      # ... create more sizes you want to access here
16
17      # Tags
18      tags
19
20      # Image credits
21      copyright
22      attribution
23
24      # Accessing alternative text
25      caption
26      altText
27
28      # Original Size Information ([w,h])
29      originalSize
30
31      # Accessing EXIF information if found for the supplied photo
32      # Access all using the field "exifIds"
33      make: exif(id: "Camera make") {
34        value
35      }
36      model: exif(id: "Camera model") {
37        value
38      }
39      focalLength: exif(id: "Focal length") {
40        value
41      }
42      exposureTime: exif(id: "Exposure time") {
43        value
44      }
45      aperture: exif(id: "Aperture") {
46        value
47      }
48    }
49  }
50}

Sandbox: Configure | Try Operation

alpaca.tech

Copyright © 2024 - Made with love ❤️ in Australia.