Skip to content

Instantly share code, notes, and snippets.

@dendeffe
Created April 27, 2011 10:32
Show Gist options
  • Save dendeffe/944034 to your computer and use it in GitHub Desktop.
Save dendeffe/944034 to your computer and use it in GitHub Desktop.
Example of SilverStripe Image template tags
$Image.SetWidth(80) // returns a image 80px wide, ratio kept the same
$Image.SetHeight(80) // returns a image 80px tall, ration kept the same
$Image.SetSize(80,80) // returns a 80x80px padded image
$Image.SetRatioSize(80,80) // **New in 2.4** returns an image scaled proportional, with its greatest diameter scaled to 80px
$Image.PaddedImage(80, 80) // Returns an 80x80 image. Unused space is padded white. No crop. No stretching
$Image.Width // returns width of image
$Image.Height // returns height of image
$Image.Orientation // returns Orientation
$Image.Filename // returns filename
$Image.URL // returns filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment