Jump to:

23451 Posts in 18899 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » $Image.setWidth

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 551 Views
  • nicanor
    Avatar
    Community Member
    15 Posts

    $Image.setWidth Link to this post

    i have a holder page, were $Image.SetWidth(50) returns the resized image. in the child page i have to use

    $showPerson.Image to show the image.

    when i try to show the resized image
    $showPerson.Image.SetWidth(50)
    i get an server error

    $showPerson.Image.Width works and returns the width.

    Any ideas how to solve $showPerson.Image.SetWidth(50) ?

  • swaiba
    Avatar
    Forum Moderator
    1788 Posts

    Re: $Image.setWidth Link to this post

    try...

    <% control showPerson %><% control Image %>
       <% control SetWidth(50) %>{$Tag}<% end_control %>
    <% end_control %><% end_control %>

    I think you cannot just keep using "dot" notation in the templates... instead treat each as shifting the context with a control

  • nicanor
    Avatar
    Community Member
    15 Posts

    Re: $Image.setWidth Link to this post

    Thank you very much swaiba. This solved my problem in less than 10 min.

  • martimiz
    Avatar
    Forum Moderator
    1078 Posts

    Re: $Image.setWidth Link to this post

    I think you can:

    <% control showPerson %>
       <% control Image.SetWidth(50) %>
          ...   
       <% end_control %>
    <% end_control %>

    551 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.