Image in Silverstrip


/ Published in: PHP
Save to your folder(s)

For us when want to add an image to silverstrip


Copy this code and paste it in your HTML
  1. static $has_one = array(
  2. 'BannerImage' => 'Image'
  3. );
  4.  
  5.  
  6. function getCMSFields() {
  7. $fields = parent::getCMSFields();
  8. $fields->addFieldToTab("Root.MyBannerImage", new ImageField("BannerImage"));
  9. return $fields;
  10. }
  11.  
  12. //TEMPLATE
  13. <% control BannerImage %>
  14. <% control ResizedImage(150,100) %>
  15. <img src="$URL" alt="" width="150px" height"100px" />
  16. <% end_control %>
  17. <% end_control %>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.