Copied to clipboard

Flag this post as spam?

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


  • Gordon Saxby 1461 posts 1883 karma points
    Jun 10, 2010 @ 18:10
    Gordon Saxby
    0

    Resize image when loading to Media Lirary

    I am working on a site that will have quite a few images, which will be uploaded by the client.

    Is there a control that will allow either the client manually, or me programmatically, to resize the images as part of putting them into the Media Library - probably as part of adding a document / node, rather than direct to the Media Library?

    I know there is ImageGen (very good, used it before!) but I want the images resized before they get saved to the Media Library. The source images are promotional shots from manufacturers and will typically be much too large for use on the website.

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Jun 10, 2010 @ 18:59
    Peter Dijksterhuis
    0

    Hi,

    you could try zip-upload for this. It has the ability to create different sizes of the image while you upload them.

    http://our.umbraco.org/projects/zip-upload

    Regards,

    Peter

  • Gordon Saxby 1461 posts 1883 karma points
    Jun 11, 2010 @ 15:12
    Gordon Saxby
    0

    Umm, I can't see where the size might be defined?

    I think I will push them towards sizing the images before uploading!

  • Dan 1288 posts 3921 karma points c-trib
    Jun 11, 2010 @ 15:21
    Dan
    0

    Hi Gordon,

    Not had chance to use it yet, but the new SUMO project looks like it'll do just what you need...

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Jun 11, 2010 @ 16:57
    Peter Dijksterhuis
    1

    There's a config file for that package. In that file, you can define the sizes you want.

    It will then create all images in the sizes you defined.

    Just found it myself this week, worked liek a charm.

    Peter

  • Gordon Saxby 1461 posts 1883 karma points
    Jun 11, 2010 @ 19:08
    Gordon Saxby
    0

    Hi Dan,

    SUMO looks like it is going to be something rather good, however the current version only says it supports "rotate, flip & crop" - i.e. not resize

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Jun 11, 2010 @ 19:39
    Nik Wahlberg
    0

    Peter, can you share the config for this as I don't think it is part of the original package.

    Thanks,
    Nik

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Jun 11, 2010 @ 22:29
    Peter Dijksterhuis
    0

    Sure! (Forgot about that, I read it on Tim's blog in the comments)

    Add this to the zipUpload.config:

    <thumbnailSizes>61;200;640</thumbnailSizes>

    The numbers are the different widths you want for the images. The width will be appended to the filename:

    image.jpg (original)

    image_61.jpg 

    image_200.jpg etc

    Peter

  • Asbjørn 82 posts 195 karma points c-trib
    Jun 12, 2010 @ 01:43
    Asbjørn
    2

    This is a serious limitation of Umbraco. Most of the time you do not want users uploading 10 megapixel photos to your website, but rather resize them to a more sensible size. This is unfortunately very difficult to do in Umbraco. It's no use hooking up to the Media.AfterSave event, which would be the most logical place to do this resizing, because Umbraco has locked to uploaded file when this event is called. The only alternative is a complete reimplementation of the Upload datatype, which I'm not looking forward to. All it would have taken is a Media.UploadFinished event...

  • Asbjørn 82 posts 195 karma points c-trib
    Jun 12, 2010 @ 23:15
    Asbjørn
    1

    If anyone is interested, I have written an improved version of the standard Umbraco upload control that allows setting a max width/height for uploaded photos (only works with JEPG files at the moment, but can be expanded to other image types, if needed). Let me know, if you're interested, and I will post some source code and a dll file.

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Jun 13, 2010 @ 16:55
    Nik Wahlberg
    1

    Why not create a package and reease it in the Projects section of Our? This way others can benefit from your efforts as well (if you don't mind sharing). 

    Thanks!

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Jun 13, 2010 @ 16:55
    Nik Wahlberg
    0

    Thanks Peter for posting that. Good to know! 

  • Asbjørn 82 posts 195 karma points c-trib
    Jun 13, 2010 @ 18:47
    Asbjørn
    1

    You're probably right. That would be the best way. Though right now it feels a bit too much like a dirty hack than a proper package. But then again, it would be usefull, I think. I will have to look into making an umbraco package... Any good resources on that?

    Meanwhile, here is the dll file (just drop it in the Bin folder) as well as the source code. You should then be able to create a new data type with a render control called "Upload field with resize".

  • Daniel Bardi 927 posts 2562 karma points
    Feb 08, 2011 @ 12:00
    Daniel Bardi
    1

    I've written an Image resizer datatype.  Although it doesn't work for a bulk upload it does allow resizing images when the media is saved.

    You link the datatype to a specific media field (i.e. umbradoFile) and it will resize the image on save.

    You can add multiple resizers to a document or media type.

    You can look at it here: http://our.umbraco.org/projects/developer-tools/image-resizer

     

    I would recomend the core team consider adding an AfterFinished event (or something like that) so us developers can handle the file once it's complete when doing a bulk upload using something like the Desktop Media uploader.

  • Connie DeCinko 931 posts 1160 karma points
    May 02, 2011 @ 22:37
    Connie DeCinko
    0

    Suggested feature to add to your imager resizer:  restrict the KB of the file size.  Not only does it come in handy to restrict image dimensions, but most important often times is to prevent users from uploading 12MB images straight from their camera.

     

  • Muhammad Humayun 49 posts 79 karma points
    Mar 20, 2012 @ 00:21
    Muhammad Humayun
    0

    Hi Dan,

    I have tested Image resizer. It is very good but when user is adding images in the RTE using media file uploader, we need to select the resized one as its not a good idea to allow 10Mp photos in it.

    Guys, have you found something to update the exsisting fileupload to do the trick?

    Thanks

    Muhammad

Please Sign in or register to post replies

Write your reply to:

Draft