1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Best Practice: How to make multiple image sizes available

Best Practice: How to make multiple image sizes available

4 posts, 0 answered
  1. Rich
    Rich avatar
    27 posts
    Registered:
    20 Feb 2010
    11 Jul 2010
    Link to this post
    I have a client who wants 4 different sized images available (small, medium, large, original) for every image loaded into an Image Library within Sitefinity.  This is because they see different sizes for blogs, news items, page content, viewing a larger image, and downloading the original image.

    I understand that there is a list of thumbnail images that are available through the file type .tmb but that is just one image.
    I also understand that Sitefinity uses a list of thumbnails but only populates one.

    Is it possible to have more than 1 thumbnail associated with an image?  How can I do that programmatically?

    Currently, I have intercepted the 'Executing' event and I create the different sized images and save them in the same library with a different filename suffix (ex. __sm, __med, __lg).   I don't particularly like this method mainly because the image library is bloated with 4 times the # of images visible.

    Any ideas would be appreciated.

    Thanks,
    Rich
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    11 Jul 2010
    Link to this post
    Hi Rich Winslow,

    An item can have only one thumbnail image. You should use separate libraries for the different thumbnail or resize the image during request. You could use the built in handler to change the size on an image depending on where it will be used

    There are four query strings that are available only for image files:

    • width, height -> the strings provide measures and the image is stretched to fit in them. Example:

      http://www.my_domain.com/MyFile.sflb?width=100&height=100

    • decreaseOnly -> when true, the image could only be decreased to fit in the measures set by the width and height strings. Still, if the image is smaller, it would not be enlarged. Example:

      http://www.my_domain.com/MyFile.sflb?decreaseOnly=true&width=100&height=100

    • proportional -> when true (by default), the image is stretched only proportionally until it fits in the measures set by the width and height strings.  Example: 

      http://www.my_domain.com/MyFile.sflb?proportional=true&width=100&height=100  



    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Rich
    Rich avatar
    27 posts
    Registered:
    20 Feb 2010
    12 Jul 2010
    Link to this post
    I did discover those query string attributes, but it doesn't seem to always work (ex. an image in a blog).
    What restrictions are imposed on the use of these query string attributes with images loaded in Sitefinity image libraries?

    Thanks
    Rich
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    14 Jul 2010
    Link to this post
    Hello Rich Winslow,

    These attributes are managed by ContentHttpHandler and should apply on each image you use and that is hosted inside Images and Documents module. If the correct query string is applies after the url of your image it should be properly resized.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
4 posts, 0 answered