Created
August 15, 2013 04:06
-
-
Save zachharkey/6238187 to your computer and use it in GitHub Desktop.
From http://ecommerce.shopify.com/c/ecommerce-design/t/reside-thumb-image-for-blog-couture-theme-148530
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% assign src = false %} | |
| {% 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:' %} | |
| {% comment %} | |
| Let's assume you always add images to the blog as large. | |
| {% endcomment %} | |
| {% if src %} | |
| {% assign src = src | replace:'_large','_icon' %} | |
| {% endif %} | |
| <img src="{{ src }}" alt="article.title" /> | |
| {% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment