All things Shopify and commerce
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
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
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 understand the type but could you right a few line of code according to given contion it very helpful for me thanks
User | RANK |
---|---|
40 | |
37 | |
24 | |
22 | |
15 |
Transform this holiday season into a shopping spree. Plus, learn how to effortlessly open ...
By Jasonh Dec 8, 2023Make the shift from discounts to donations, and witness your business not only thrive fina...
By Holly Dec 4, 2023On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023