More in this section

Forums / Developing with Sitefinity / Resizing images on upload

Resizing images on upload

6 posts, 0 answered
  1. Mike
    Mike avatar
    208 posts
    Registered:
    10 Dec 2007
    12 Jan 2009
    Link to this post
    Sitefinity allows me to resize an image when it's sent to te client, but is there any easy way to resize the image during upload?  I don't want to have to limit the users to upload only small images, but for my purposes I don't need to store the image in high resolution in the database, as it will only ever be used at low resolutions. 

    Thanks
    Mike Sharp
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    12 Jan 2009
    Link to this post
    Hello Mike,

    Please check out  this KB article where we show how to change the image size. I suggest that you should alter the GenerateThumbnail() as below, otherwise the images could not be resized  properly.
    Here I set keepProprtions variable to false. When it is true, the method sets proportional dimension, not the given one. 

     img = Telerik.Cms.Engine.ImagesHelper.GenerateThumbnail(200, 200, img, falsetrue); 

    I hope this helps.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Mike
    Mike avatar
    208 posts
    Registered:
    10 Dec 2007
    12 Jan 2009
    Link to this post
    You guys are awesome!  I love being able to tell the client, "Sure, no problem".

    Thanks again,
    Mike Sharp
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    12 Jan 2009
    Link to this post
    Hi Mike,

    We are glad to help. Probably, I will try to crate a new blog post about  image uploader, which can be used on a front end page.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Elizabeth
    Elizabeth avatar
    83 posts
    Registered:
    23 Mar 2005
    29 Jul 2009
    Link to this post
    This autoresizer looks great, but I do have a question. When looking at the image in the image gallery module, while the actual size, width and height of the image have been changed, it still shows the original number in the properties. So while this example is 333 x 500 and 32K, it says:


    Also under details, it shows the original size:
    1. This name will appear as the author of this article on the site.

    2. px
    3. px

    Is there anyway of getting the correct info to show up under the properties?

    Thanks.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    30 Jul 2009
    Link to this post
    Hello Elizabeth Munsey,

    Unfortunately the values cannot be updated automatically, because the content item uses staged version although the image is correctly resized.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
6 posts, 0 answered