Copied to clipboard

Flag this post as spam?

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


  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Dec 07, 2016 @ 08:21
    Michaël Vanbrabandt
    0

    Resize and compress image during upload in the media section

    Hi all,

    is it possible to resize and compress an image during the upload in the media section?

    Can I use the image processor to do this in c# code during the media saving event or.. ?

    Another requirement is that this resizing and compressing is only done when an image is uploaded to a certain folder.

    Kind regards,

    /Michaël

  • Phil Whittaker 63 posts 267 karma points MVP 4x c-trib
    Dec 07, 2016 @ 14:05
    Phil Whittaker
    100

    Hi

    Yes you can use the media saving event and create a new image from here.

    Alternatively you could do the image process on the front end using image processor and "remote.axd", then you wouldn't be tied to code.

    Or you could set up an image cropper data type on your content and define the sizes there.

    Phil

  • Damien (Slipoch) 62 posts 346 karma points
    Sep 08, 2017 @ 07:02
    Damien (Slipoch)
    0

    Any details or links as to how to do this?

    Cheers

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Sep 08, 2017 @ 07:25
    Chriztian Steinmeier
    1

    Hi Damien,

    Have a look at James' (author of ImageProcessor) post on 24 Days In Umbraco here: https://24days.in/umbraco-cms/2014/all-your-images-are-belong-to-umbraco/

    It explains how to pre-process images if you need to.

    Hope that helps,

    /Chriztian

  • Damien (Slipoch) 62 posts 346 karma points
    Sep 10, 2017 @ 23:04
    Damien (Slipoch)
    0

    Yep, I looked at that one already, unfortunately it does not seem to be working.

    It processes but does not seem to save the file.

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Sep 08, 2017 @ 07:51
    Dan Diplo
    0

    If you are using Umbraco 7 then you can set crop sizes on any uploaded images - https://our.umbraco.org/Documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/Image-Cropper

    If you want images compressed automatically I'd recommend installing http://imageprocessor.org/imageprocessor-web/plugins/postprocessor/ - it will recompress all images cached by imageprocessor.

  • Damien (Slipoch) 62 posts 346 karma points
    Jan 24, 2018 @ 22:04
    Damien (Slipoch)
    0

    I just want to compress the images on upload during a form/controller upload process using HttpPostedFileBase. Not all images cached, nor all uploads from backoffice.

    For the suggestion above by Phil Whittaker, could someone post an example as the docs are out of date and the instructions do not work.

  • 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