/ Published in: PHP
For us when want to add an image to silverstrip
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
static $has_one = array( 'BannerImage' => 'Image' ); function getCMSFields() { $fields = parent::getCMSFields(); $fields->addFieldToTab("Root.MyBannerImage", new ImageField("BannerImage")); return $fields; } //TEMPLATE <% control BannerImage %> <% control ResizedImage(150,100) %> <img src="$URL" alt="" width="150px" height"100px" /> <% end_control %> <% end_control %>