Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Saied 349 posts 674 karma points
    May 24, 2016 @ 17:14
    Saied
    0

    Serve scaled images?

    Hi,

    I am not using the media library to house my images. I am using an azure cdn. Right now, I am serving the same image resolution no matter what device. I was wondering what is the best way to scale and serve the image dynamically using .NET?

    Thanks

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 25, 2016 @ 05:16
    Jan Skovgaard
    0

    Hi Saied

    You should be able to make use of the image cropper functionality even though the images are not picked using the image cropper in Umbraco.

    You should be able to use path/toyourimage/image.jpg?width=210 for instance.

    You can see the different parameter options here http://imageprocessor.org/imageprocessor-web/imageprocessingmodule/resize/

    I hope this helps? :)

    /Jan

  • Saied 349 posts 674 karma points
    May 25, 2016 @ 14:37
    Saied
    0

    Hi Jan,

    Thanks for the input. Do you know of a best way to determine the widths to use for different resolutions? I was thinking of using this for the img element srcset attribute?

    I tried to do:

    <img class="rsTmb" src="@string.Concat(Model.BaseImageUrl,Model.ProductImage1Url).GetCropUrl(73,73)" alt="">

    and

    <img class="rsTmb" src="@string.Concat(Model.BaseImageUrl,Model.ProductImage1Url)?width=73&height=73" alt="">

    but it still downloads the larger image instead of re-sizing it to 73x73.

    I tried it on an image that is not on azure and it resized it, but if I try the width and height attributes on an image on azure, it downloads the original image.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 26, 2016 @ 05:10
    Jan Skovgaard
    0

    Hi Saied

    Oh, I don't know about when getting the image from azure. But seems like you created another post for that already? :)

    What I thought was that you had some images outside the "Media" section of Umbraco on your disk in a another folder, which could be "images" for instance. That scenario should work with the image processor if I'm not mistaken. But I have no clue about the azure thing.

    /Jan

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies