Jump to:

1382 Posts in 491 Topics by 521 members


SilverStripe Forums » Themes » Resizing picture in templete

Discuss SilverStripe Themes.

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

Page: 1
Go to End
Author Topic: 3488 Views
  • anujkryadav
    Community Member
    30 Posts

    Resizing picture in templete Link to this post

    i am trying to resize a picture in template but it is giving me error
    the code i have tried are

    $Photo.SetSize(80 , 80)
    $Photo.SetSize(80, 80)

    error i have received is

    Missing argument 1 for Image::SetSize()


    $Photo.PaddedImage(80, 80)
    $Photo.PaddedImage(80 , 80)

    the error i have received is

    imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions

    I am trying to resize the image without cropping it.

    when i am calling only the variable its showing the picture

    thank you in advance

  • 3dgoo
    Community Member
    133 Posts

    Re: Resizing picture in templete Link to this post

    Should work according to this:

    I'm too lazy to test this right now, sorry.

    Another way to do this is through a conrol. Have a read of this:

    <% control Photo %>
       <% control PaddedImage(80, 80) %>
          <img src="$URL" alt="A cropped image" />
       <% end_control %>
    <% end_control %>

    Sorry about the late reply.

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.