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.

Customising the CMS /

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

Image gallery - how to resize

Go to End



Community Member, 18 Posts

18 March 2009 at 7:57pm

Edited: 18/03/2009 8:00pm


I need to resize the images in my gallery before sending them to the client browser. The images have sizes of 500 kb (but resized only about 50 kb).

I have in Page.php created a function
function FrontPageRotator() {
return DataObject::get("Image", "`ParentID` = 31");

And in the following template code
<% if FrontPageRotator %>
<% control FrontPageRotator %>
<img class="frame" src="$Link" style="display:<% if First %>block;<% else %>none;<% end_if %>" width="270" height="220"/>
<% end_control %>
<% end_if %>

I wanted to have $Image.setWidth(140) instead of $Link, but I dont seem to be able to refer to $Image.
Can anyone help?

Thanks in advance.

Best regards Trym