New Shopify Certification now available: Liquid Storefronts for Theme Developers

Metafield

Jack_Khan_Baba
Shopify Partner
65 6 13

Hi if i can select a metafield type File and check both the value image and video
now i did not understand on which base i can seperate them.
how i can access them 
11.PNG

here is code that i can try it is working fine if i can upload a image but i cant understand how i can get the video
code:
<div class="custom-file-type">

<img src="{{ product.metafields.custom.file.value | img_url:'master' }}">

 

</div>

 

it work fine but if the user select the video so how i can access it any suggestion how i can differentiate on the base of file type.
if there is video it show the video and if user select the imaage it display the image 
please help

Replies 2 (2)
Jason
Shopify Expert
11159 222 2274

You can look at the media type. It will return image for images, and generic_file for everything else. That should be good enough for you to know that's a video in your example. The file extension would also give you a very strong indicator of the file type.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
Jack_Khan_Baba
Shopify Partner
65 6 13

i understand the type but could you right a few line of code according to given contion it very helpful for me thanks