Does anyone know how to access the image_tag rails helper from within a liquid drop ?
Any help / examples would be great as i can’t seem to find this anywhere!
thanks
rick
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You mean the Liquid Template engine right?
If so, by design, the
image_taghelper is entirely unavailable from within Liquid templates. This is the express purpose of Liquid, you aren’t able to execute any Ruby code on the server running Liquid, just the set of helpers that it provides you.If you are making a Shopify store or something like this where you are using Liquid on someone else’s servers, then you are stuck manually doing what the
imagetag helper does normally. You have to write out<img src="{{ something.url }}>.If you are making or running your own Rails application which uses Liquid, you can add your own
image_tagstyle filter to Liquid so that its available for use in all your templates.See Liquid for Programmers on the Github wiki.
Hope this helps!