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.

General Questions /

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

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

$Image.setWidth


Go to End


4 Posts   1312 Views

Avatar
nicanor

Community Member, 15 Posts

9 August 2011 at 1:45am

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) ?

Avatar
swaiba

Forum Moderator, 1899 Posts

9 August 2011 at 1:50am

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

Avatar
nicanor

Community Member, 15 Posts

9 August 2011 at 1:58am

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

Avatar
martimiz

Forum Moderator, 1391 Posts

9 August 2011 at 5:03am

I think you can:

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