What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

how to upload preview image for video files uploaded by new file api

how to upload preview image for video files uploaded by new file api

tknbgl
Visitor
1 0 0

Hi,

I uploaded a video file by using stagedUploadsCreate and fileCreate mutation. Everything worked fine and I've seen the files I uploaded in the settings/file page on shopify. However there seems to be no way to change preview image of files. When I query files, I see they have preview object and from there I can get preview image url through originalSrc parameter.

example:

 

 

{
 files(first:10) {
  	edges {
      node {
        ... on GenericFile {
            createdAt,
            fileStatus,
            id,
            alt,
            url,
            preview {
                status,
                image {
                    originalSrc,
                    height,
                    width
                }
            }
        }
      }
    }
	}
}

 

 

 

 

 

{
                    "node": {
                        "createdAt": "2021-10-19T09:28:02Z",
                        "fileStatus": "READY",
                        "id": "gid://shopify/GenericFile/22400487063747",
                        "alt": "utku-video",
                        "url": "https://cdn.shopify.com/s/files/1/0274/0007/7396/files/movie-utku.mov?v=1634635683",
                        "preview": {
                            "status": "READY",
                            "image": {
                                "originalSrc": "https://cdn.shopify.com/s/files/1/0274/0007/7396/files/preview_images/video-511a7aa6bf7aa17597dca41223381fd43a4a9a488d133b5c09e035c321761e7b_a1a343ee-c20a-4089-99e4-1e0e3c72e0d4.png?v=1634635684",
                                "height": 2048,
                                "width": 2048
                            }
                        }
                    }
                }

 

 

 

I searched through admin api documentation, but can't find any solution that addresses my problem. There are ways to change product media preview image but that's not my case I guess. I there anyway to upload file with previewImage ?

 

thanks.

Reply 1 (1)

yinghechen
Shopify Partner
9 0 0

Hi, I am on the same boat. Did you figure out how to change the preview image of the video ?