Skip to content

[digital ocean] Dimensions missing from image asset #25

@magicspon

Description

@magicspon

Hello,

Having some issues with the digital ocean version and image dimensions.

Given this query:

*[_type == "display"][_id == $id][0...1] { 
  "slug": slug.current, 
  "content": content[] { 
    _key, "content": 
    content-> { 
      duration, 
      "media": media { 
        type, 
        type == "video" => { 
          _type, 
          type, 
          "video": video.asset-> { url } }, 
          type == "image" => { 
            _type, "image": 
            image { 
              _type, "asset": 
              asset-> { 
                "src": digitalOcean.originURL, 
                "width": dimensions.width, 
                "height": dimensions.height, 
                dimensions, 
                "alt": title, 
                fileName, 
                fileURL, 
                digitalOcean 
             } 
          } 
        } 
      } 
    }
  } 
}

I'm getting this response:

{
  "slug": "test",
  "content": [
    {
      "_key": "879e2e18319f",
      "content": {
        "duration": 10,
        "media": {
          "type": "image",
          "_type": "asset",
          "image": {
            "_type": "digital-ocean-files.media",
            "asset": {
              "alt": null,
              "digitalOcean": {
                "bucket": "redacted",
                "key": "store/1760006987657-45df72b5fcb1b76c-2025-10-09T10-49-47.645Z-android-chrome-512x512.png",
                "originURL": "https://redacted.lon1.digitaloceanspaces.com/store/1760006987657-45df72b5fcb1b76c-2025-10-09T10-49-47.645Z-android-chrome-512x512.png",
                "region": "lon1"
              },
              "dimensions": null,
              "fileName": "2025-10-09T10-49-47.966Z-android-chrome-512x512.png",
              "fileURL": "https://staging-compiled-files-respository.lon1.cdn.digitaloceanspaces.com/store/1760006987657-45df72b5fcb1b76c-2025-10-09T10-49-47.645Z-android-chrome-512x512.png",
              "height": null,
              "src": "https://redacted.lon1.digitaloceanspaces.com/store/1760006987657-45df72b5fcb1b76c-2025-10-09T10-49-47.645Z-android-chrome-512x512.png",
              "width": null
            }
          }
        }
      }
    }
  ]
}

This is the field (it was previously an image field, i just changed the type leaving the other options as is

defineField({
	name: 'image',
	type: 'digital-ocean-files.media',
	title: 'Image',
	options: {
		collapsed: false,
		hotspot: true,
	},
	hidden: ({ parent }) => parent?.type !== 'image',
	validation: (rule) =>
		rule.custom((value, context) => {
			if ((context?.parent as any)?.type === 'image') {
				if (!value) {
					return 'Image is required when type is image'
				}
			}
			return true
		}),
}),

Should I be able to get the width and height of images uploaded to s3.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions