Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Cache and resize images in entries using Lumis imgsizer, Matrix, and Stash
{!--
# FIELDS
1. Matrix: images
* File: image
* PT Pill: alignment (left, right, or block)
* Text: description
* PT Pill: width
2. Textarea/WYSIWYG: body
# PLACING IMAGES IN THE ENTRY
The entry author will need to enter tags for the images' corresponding row numbers into the body.
Ex. `{1}`
--}
{exp:channel:entries
channel = "channel_name"
limit = "1"
}
{!-- This must be before the exp:stash:get tag --}
{images}
{exp:stash:set name="{row_count}"}
{exp:imgsizer:size class="{alignment}" src="{image}" alt="{description}" width="{size}"}
{/exp:stash:set}
{/images}
{exp:stash:get}{body}{/exp:stash:get}
{/exp:channel:entries}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment