Copied to clipboard

Flag this post as spam?

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


  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 18, 2014 @ 20:49
    Fuji Kusaka
    0

    Regrouping a list of Images for Download

    Has anyone ever tried regrouping a list of image in a specific media folder for download?

    Let say i have a news item where i will make use of a media picker to display the images in a slider and at same i can make those images downloadable. So instead of downloading the images a maximum of 5 low resolution images i will be able download all 5 images.

    Any idea how i might do this ? 

    //fuji

  • Ravi Motha 290 posts 500 karma points MVP 8x c-trib
    Feb 19, 2014 @ 15:31
    Ravi Motha
    0

    looking at references what you you would do the following

    get the media ids for the files selected  in your slider carousel.

    create the paths  using server map paths and the getfilename functions in umbraco

     and then use a tool like SharpZipLib or dotnetzip http://dotnetzip.codeplex.com/ to createa package from the selected files on your webserver,

    Then create the the zip as a new media item and then output that for user to download..

  • Anders Bjerner 487 posts 2990 karma points MVP 8x admin c-trib
    Feb 19, 2014 @ 17:37
    Anders Bjerner
    0

    As Ravi suggests, the images can be zipped and made available for download. Umbraco already uses SharpZipLib ( http://www.nuget.org/packages/SharpZipLib/ ;), so that would be ideal to use, since the DLL already is in the bin folder.

  • Ravi Motha 290 posts 500 karma points MVP 8x c-trib
    Feb 19, 2014 @ 17:42
    Ravi Motha
    0

    I hadn't checked on Sharp Zip lib being included but there you go

  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 19, 2014 @ 17:58
    Fuji Kusaka
    0

    Hi guys sorry i only have my mob with me at the moment but will give this a try. Thanks to both of you.

  • Fuji Kusaka 2203 posts 4220 karma points
    Mar 02, 2014 @ 08:26
    Fuji Kusaka
    0

    Its only now i can have a look at this. As mentioned in my previous post the idea is to be able to down all images within a media Folder where there will be a maximum of 5 images all the time.

    Here am using mediaPicker and displaying all 5 images, but not sure how to add create a zip file where all the 5 images will be downloable. So lets say the Media Folder in my media Section is "News Item 1" + 5 images in it, i would be able to download a zip file called "News Item.zip"

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Mar 02, 2014 @ 09:30
    Fuji Kusaka
    0

    Here is how am doing it but dont think this is the right. How do i get to use Sharp Zip here.

    var mediaPicker = Model.pressImgPicker;
    
        if(!String.IsNullOrEmpty(mediaPicker)){
            var mediaFolder = Model.MediaById(mediaPicker);
            var mediaItem = mediaFolder.Children;
    
             if(mediaItem.Count() > 0){
                string zipName = Server.MapPath(umbraco.GlobalSettings.StorageDirectory) + "\\" + mediaFolder.Name.Replace(" ","") + ".zip";
    
                     }
    
        }
  • Ravi Motha 290 posts 500 karma points MVP 8x c-trib
    Mar 04, 2014 @ 17:55
    Ravi Motha
    0

    you should be  able to use this as a starting point. this would cretae the zip and then you need to add your files to the zip in the zipfileList and then that would do most of the heavy lifting for you..

     

    https://github.com/icsharpcode/SharpZipLib/wiki/Zip-Samples#wiki-anchorCreateIIS

Please Sign in or register to post replies

Write your reply to:

Draft