-
Notifications
You must be signed in to change notification settings - Fork 15
Asset
Everett Griffiths edited this page Jun 26, 2014
·
5 revisions
Returns a single asset
The Asset Snippet accepts the following arguments:
-
&asset_id
(integer) Unique asset id of the asset you would like to display. -
&width
(integer) in pixels (optional) -
&height
(integer) in pixels (optional) -
&tpl
(string) either a MODX chunk or a formatting string
Note the following behavior when specifying the desired size:
- If no &height or &width arguments are passed, then the full size of the original asset will be returned.
- If the snippet call sets a &width but no &height, then the result will be scaled to the desired width.
- If the snippet call sets a &height but no &width, then the result will be scaled to the desired height.
- If both &height and &width are set, scale to the desired dimensions. This does may distort the image!
[[Asset? &asset_id=`123`
&tpl=`<img src="[[+url]]"/>`
&height=`100`
&width=`100`
]]
© 2014 and beyond by Craftsman Coding