Created
February 13, 2014 01:52
-
-
Save dominikwilkowski/8968287 to your computer and use it in GitHub Desktop.
This snippet lookes at its input string and returns either the input or a fallback image in a specific size, no path though
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
{% comment %} | |
This snippet lookes at its input string and returns either the input or a fallback image in a specific size, no path though | |
Usage: | |
{% assign newImageSize = "medium" %} (optional) | |
{% include 'make-image' with imageString %} | |
Return: | |
{{ newImageSize }} (either as input or fallback) | |
Required: | |
Fallback images with the following naming: | |
no-image-pico.gif | |
no-image-icon.gif | |
no-image-thumb.gif | |
no-image-small.gif | |
no-image-compact.gif | |
no-image-medium.gif | |
no-image-large.gif | |
no-image-grande.gif | |
no-image-1024x1024.gif | |
no-image-2048x2048.gif | |
{% endcomment %} | |
{% assign newImage = make-image %} | |
{% if newImageSize == nil %} | |
{% assign newImageSize = "medium" %} | |
{% endif %} | |
{% if newImage.size == nil %} | |
{% capture newImage %}no-image-{{ newImageSize }}.gif{% endcapture %} | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment