4.4 Server Side Re-sizing of Images

Posted by Community Admin on 04-Aug-2018 23:24

4.4 Server Side Re-sizing of Images

All Replies

Posted by Community Admin on 26-Jan-2012 00:00

All,

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

ex  "http://domain.com/libraries/library_name/image_name.sflb?width=640&height=480&proportional=true"

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

Posted by Community Admin on 27-Jan-2012 00:00

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:
domain.com/.../image_name.ext
This would constrain the image to a max of 640 either in height or width.

This thread is closed