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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

Size of images in ecommerce

Go to End

4 Posts   1589 Views


Community Member, 81 Posts

20 January 2009 at 11:47pm


I think i may be having trouble with somthing which is actualy quite simple, im trying to set the thumbnails on products pages to be 200px wide (currently 100px). How would i go about doind this? iv tried $Image.SetWidth(200) but that didnt work. Any ideas on how to do this?



Community Member, 81 Posts

21 January 2009 at 4:43am


Bit of an update iv kinda managed to fix the problem but its a bit of a hack, at the moment im haveing to put this code in my template file

<!-- $Image.SetWidth(200); -->
<img src="assets/Uploads/_resampled/SetWidth200-{$Image.Name}" class="jqzoom" alt="$Image.Filename" />

The first line is needed to generate the regenerated image but is commented out in the html to prevent it being displayed as i need the image to have class="jqzoom" this is a bit of a hack as the resulting html looks like

<!-- <img src="/assets/Uploads/_resampled/SetWidth200-IMG4672.jpg" alt="" />; -->
<img src="assets/Uploads/_resampled/SetWidth200-IMG4672.jpg" class="jqzoom" alt="assets/Uploads/IMG4672.jpg" />

any ideas on how to do it withour the hack?


Forum Moderator, 5523 Posts

21 January 2009 at 3:02pm

You can loop over the Image with a Control

<% control Image.SetWidth(200) %>
<img src="$URL" class="jqzoom" alt="$Title" />
<% end_control %>

Or you will have to do

<% control Image %>
<% control SetWidth(200) %>
<img src="$URL" class="jqzoom" alt="$Title" />
<% end_control %>
<% end_control %>


Community Member, 81 Posts

22 January 2009 at 12:01am

Thanks the top option should do what i want and make the output a lot cleaner :-).

Il have to look into <% control a bit more, didnt realize could do that sort of thing with it