Created
November 28, 2012 16:38
-
-
Save jordanmoore/4162420 to your computer and use it in GitHub Desktop.
Responsive Images in WYSIWYG fields in Expression Engine
This file contains 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
{!-- Entry template --} | |
{exp:channel:entries channel="YOUR-CHANNEL-NAME" url_title="{embed:url_title}" limit="1" disable="categories|member_data" dynamic="off"} | |
<hr> | |
{exp:low_replace | |
find="{overview_images backspace="1"}[image{row_count}]|{/overview_images}" | |
replace="{overview_images backspace="1"}{embed=shared/_inline_image number='{row_count}' url_title='{url_title}' channel='YOUR-CHANNEL-NAME' field_name='overview_images'}|{/overview_images}" | |
multiple="yes" | |
} | |
{overview} | |
{/exp:low_replace} | |
<hr> | |
{/exp:channel:entries} | |
{!-- Embed template --} | |
{exp:channel:entries channel="{embed:channel}" url_title="{embed:url_title}" limit="1" dynamic="off" disable="pagination|categories|member_data"} | |
{{embed:field_name}} | |
{if row_count == "{embed:number}"} | |
<figure> | |
{if {ress} <= "500"} | |
{exp:ed_imageresizer image="{image}" maxWidth="960" alt="Small" quality="20"} | |
{if:else} | |
{exp:ed_imageresizer image="{image}" maxWidth="2048" alt="Big" quality="40" forceWidth="yes"} | |
{/if} | |
<figcaption> | |
<p>{caption}</p> | |
<p class="copy">© {credit}</p> | |
</figcaption> | |
</figure> | |
{/if} | |
{/{embed:field_name}} | |
{/exp:channel:entries} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment