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

tknbgl
New Member
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.

Replies 0 (0)