eriksilver
11/21/2013 - 10:47 PM

Get image src from a string in Liquid

Get image src from a string in Liquid

{% if article.content contains "<img" %}
    {% assign src = article.content | split: 'src="' %}
    {% assign src = src[1] | split: '"' | first | replace: '//cdn', 'http://cdn' | replace: 'http:http://', 'http://' | remove: 'https:' %}
{% endif %}