Development discussions around Shopify APIs
Return management just got easier! We’ve launched Customer Self-Serve Returns to all Shopify merchants. Click here to learn more!
Hi All,
Is there a way to set the "src" attribute of ImageInput in GraphQL to base64 data urlor a generated url using window.URL.createObjectURL(imageFile)). I tried it but no way! I would highly appreciate your help.
Kind Regards,
Mazen
Hey @MazenMustafa,
The API will only provide an image URL, but you might be able to find a JS library to convert the URL to base64.
Scott | Developer Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hi @SBD_ , Thanks for your reply, I appreciate it. Yes, I found a JS library to covert into base64. However when I place it in the "src" property, it does not work! So, would you please make sure if the "src" property accepts base64?
This is a browser/HTML thing. This thread might help you troubleshoot: https://stackoverflow.com/questions/8499633/how-to-display-base64-images-in-html
Can you provide an example of it not working? Let me know if I'm missing something.
Scott | Developer Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
@SBD_ I appreciate your help. I tried it again but it's not working when placing base64 image into the src property of ImageInput, attached the debugger details for the example I tested, If I place a url , it works.
This is the example source code:
Hey @MazenMustafa,
Apologies, I misunderstood your goal. You'll need to provide a URL to the imageInput (more info).
Scott | Developer Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
User | RANK |
---|---|
16 | |
7 | |
6 | |
6 | |
5 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022