Jump to:

2088 Posts in 1008 Topics by 455 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » Size of images in ecommerce

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, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1209 Views
  • Phill
    Avatar
    Community Member
    75 Posts

    Size of images in ecommerce Link to this post

    Hey

    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?

    Thanks

  • Phill
    Avatar
    Community Member
    75 Posts

    Re: Size of images in ecommerce Link to this post

    Hey,

    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?

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Size of images in ecommerce Link to this post

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

  • Phill
    Avatar
    Community Member
    75 Posts

    Re: Size of images in ecommerce Link to this post

    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

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