Skip to content

Instantly share code, notes, and snippets.

@curtisblackwell
Created August 13, 2011 10:03
Show Gist options
  • Save curtisblackwell/1143703 to your computer and use it in GitHub Desktop.
Save curtisblackwell/1143703 to your computer and use it in GitHub Desktop.
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