Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

DataObject Image Issue


Go to End


4 Posts   1780 Views

Avatar
aTTi

Community Member, 19 Posts

25 August 2010 at 12:49am

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

Avatar
Martijn

Community Member, 271 Posts

25 August 2010 at 12:57am

Better add a method to perform the cropping:

if Slideshow has_one Image

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

in template $Thumbnail

Avatar
UncleCheese

Forum Moderator, 4102 Posts

25 August 2010 at 2:12am

Edited: 25/08/2010 2:13am

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 %>

Avatar
aTTi

Community Member, 19 Posts

25 August 2010 at 2:19am

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