Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » DataObject Image Issue

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 1111 Views
  • aTTi
    Avatar
    Community Member
    19 Posts

    DataObject Image Issue Link to this post

    Hello folks!

    I'm having a problem with the DOM.

    I created a DataObject called "Slideshow".

    Now i would like to display all those images on the Page e.g

       <% control Slideshow %>
          <% control CroppedImage(550,211) %>
             <img src="$URL" alt="" class="cycle" />
        <% end_control %>
       <% end_control %>

    But this does not work, i can't get the right <img src="">

    Does i miss something?

    Greetz

    aTTi

  • Martijn
    Avatar
    Community Member
    271 Posts

    Re: DataObject Image Issue Link to this post

    Better add a method to perform the cropping:

    if Slideshow has_one Image

    function Thumbnail(){
          return $this->Image()->CroppedImage(250,250);
       }

    in template $Thumbnail

  • UncleCheese
    Avatar
    4085 Posts

    Re: DataObject Image Issue Link to this post

    Look closely at your control.. You never refer to the image that is associated with that DataObject. There is no method "CroppedImage" on your slideshow object.

    <% control Slideshow %>
    <% control YourImageField %>
    <% control CroppedImage(550,211) %>
    <img src="$URL" alt="" class="cycle" />
    <% end_control %>
    <% end_control %>
    <% end_control %>

  • aTTi
    Avatar
    Community Member
    19 Posts

    Re: DataObject Image Issue Link to this post

    Thanks for the fast answers, it works like a charm now

    1111 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.