More in this section

Forums / Developing with Sitefinity / 4.4 Server Side Re-sizing of Images

4.4 Server Side Re-sizing of Images

2 posts, 0 answered
  1. Anthony
    Anthony avatar
    9 posts
    15 Nov 2011
    26 Jan 2012
    Link to this post

    I am aware that sitefinity 3.x versions allowed you to use a url to re-size an image on the server side.

    ex  ""

    However, we noticed this method does not work for version 4.4. We would like to avoid writing a custom .cs class just to re-size images. Is there anyway we can achieve resizing without writing custom code?

    - Anthony
  2. Richard Baugh
    Richard Baugh avatar
    201 posts
    22 Aug 2012
    27 Jan 2012
    Link to this post
    I haven't tried this in 4.4 just yet but in a 4.2 site we are just using ?size= and then the size to constrain to. With this approach, it will re-size the image so that it won't be any wider or taller than specified size. There really isn't anything that I am aware of that allows for specific height and width properties to be specified.

    I like this approach as it keeps the proportion and just determines if the image is a portrait or landscape and then uses the higher value to constrain. The re-size would happen on the server side so you actually got an image with the smaller size.

    So for your example, you could use the following:
    This would constrain the image to a max of 640 either in height or width.
2 posts, 0 answered