Can I bulk download images as a ZIP file?

UPDATE: a new and much more advanced API was recently introduced to support generating zipped archives and bulk downloading your content. For more information see: generate_archive documentation and the complementary blog post.

From this point forward, documentation is outdated and API is deprecated.

Of course!

You can create a URL for bulk downloading a ZIP of images that share a certain tag. Generating ZIP files is done by using our multi API.
After generated, the ZIP file is stored in your account and will be delivered and cached through the CDN.

Here's a Ruby code example for creating a ZIP file of all images sharing the 'logo' tag:

Cloudinary::Uploader.multi("logo", :format => 'zip')

This will result a URL like the following:
http://res.cloudinary.com/demo/image/multi/v1376634265/logo.zip

Transformations can also be applied, for example:

Cloudinary::Uploader.multi("logo", :format => 'zip', :width => 150, :height => 100, :crop => :fill)

This will result a URL like the following:
http://res.cloudinary.com/demo/image/multi/c_fill,h_100,w_150/v1376634265/logo.zip

Note that each ZIP file can contain up to 500 images.

We recommend to include the version part to the URL to avoid stale cache issues when regenerating the ZIP.

UPDATE: Cloudinary now supports generating flat ZIP files, ignoring folders hierarchy.

For additional methods to bulk download your assets from Cloudinary, visit the following link: http://support.cloudinary.com/hc/en-us/articles/203068641-Can-I-bulk-download-all-of-my-Cloudinary-resources-

 

Have more questions? Submit a request

Comments

  • Avatar
    oleg moseyko

    how to download images whith JS

  • Avatar
    Stadri Emblems

    Hi Itay,

    I'm using Cloudinary to upload PDF and I can do it successfully. Everything works and I can download them individually. However, when I try this method you mentioned above to obtain my PDF files inside a zip file I get an error "No images found for multi pdf_upload". I'm using Django.

    When I upload the PDF I get this response:

    {"secure_url": "https://res.cloudinary.com/my-account/raw/upload/v1385505701/order_56_20131126.pdf.pdf", "public_id": "order_56_20131126.pdf.pdf", "tags": ["20131126", "pdf_upload"], "url": "http://res.cloudinary.com/my-account/raw/upload/v1385505701/order_56_20131126.pdf.pdf", "created_at": "2013-11-26T22:29:44Z", "bytes": 95410, "version": 1385505701, "signature": "6f10221667fe19b976f8a735793c56f3f0b1c271", "type": "upload", "resource_type": "raw"}

    So, I know that my PDF files are tagged and uploaded properly.

    So, my question is does Cloudinary support multiple PDF downloads by tag or is it just images it can zip?

    The code I'm using is straight forward:

    from cloudinary import uploader

    uploader.multi("pdf_upload", format="zip")

    Cheers,

    Mario

     

  • Avatar
    Itay Taragano

    It seems like your PDF was uploaded as a 'raw' file instead of the default 'image' resource_type. Please upload PDFs in standard resource_type (default: 'image'). This will allow you to both generate a ZIP file and generate thumbnails from PDFs to image types (e.g., JPG, PNG, etc.).

  • Avatar
    System Administration

    Hi,

    There seems to be a limit to the size of the zip file (30MB). Can this be increased? We have more than 30MB of files (with the same tag).

    Is there a way to specify image dates or a range to zip so that I can download my content in chunks.

    Atif

  • Avatar
    Nicholas Friend

    Hi Guys, is there a way to download a zip file of images, based on an array of URL's?

  • Avatar
    Itay Taragano

    Currently ZIP files can be generated based on images sharing a certain tag only. 

    You can write a short script which goes through your images and tag them, for example:

    Cloudinary::Uploader.add_tag('temp_tag', ['image1', 'image2'])

    Then generate the ZIP as demonstrated in the Forum, and afterwards you can remove the tag from the images, for example:

    Cloudinary::Uploader.remove_tag('temp_tag', ['image1', 'image2'])

  • Avatar
    Christian Fehrlin

    Hi, is there any way to use this API through javascript?

    I couldn't find any information as to how that's possible nor did I find anything in the cloudinary_js source code...

    In the backend we're using java (we're already using a service to sign uploads), but even in the java docs I couldn't find any mention of this feature...

  • Avatar
    Jeremy Kallman

    This feature is great! But is there further documentation available? For example, how do we know when the ZIP file is created and present? Is there a callback of some kind? And also, what happens if you exceed the 500 file limit?

    Thanks in advance!

  • Avatar
    Bartosz Tomczak

    i used this https://github.com/qLb/downloadcloudinaryimages, it doesn't zip but downloads all images from the platform. Nice and almost easy :)

  • Avatar
    Ajit Singh

    HI, Itay

    i am not able to download video with bulk resource downloading using multi, even i'm not able to tag video resource

    var tagParams_Add = new TagParams()
    {
    PublicIds = PublicIds,
    Command = TagCommand.Add,
    Tag = tag
    };
    m_cloudinary.Tag(tagParams_Add);

    its not adding tag to video resource. if i manually tag the video , multi method is not downloading the video

  • Avatar
    Alex Caldas

    Hi Itay,

    In order to tag all uploaded images, could you please share a C# code on how to list all uploaded images and extract the folder they are in?

    I plan to tag them based on the folder, share a code snippet on how to tag them as well.

    Once they are tagged, I know how to create a zip based on a tag with a transformation.

    Thanks!

  • Avatar
    Nadav Ofir

    Ajit, try to set the `resource_type` parameter to video in both tag() and multi() APIs. If this doesn't help, please contact us with more details and we'll be happy to help further.

  • Avatar
    Nadav Ofir

    Alex, while this API is still available and can serve you as you described, a better practice will be to use the new generate_archive API which allows you to assemble an archive based on resource prefixes (e.g. folders hierarchy).

  • Avatar
    Alex Caldas

    Hi Nadav, I'm working with C# and according to you the generate_archive API is not yet supported in .net, so I'm using the Multi API, see code below, to get a zip file with a transformation based on a tag.

    However, I need to loop thru all the uploaded images and tag them based on the folder they are in, could you please share C# code to accomplish this task?

    Cloudinary cloudinary = new Cloudinary(account);
    Transformation transform = new Transformation();

    transform.Height(100);
    transform.Crop("scale");

    MultiParams parameters = new MultiParams("kiss");

    parameters.Format = "zip";
    parameters.Transformation = transform;

    MultiResult result = cloudinary.Multi(parameters);

    if (result.Uri != null)
    {
    string url = result.Uri.ToString();
    Response.Write("" + url + "");
    }

  • Avatar
    Nadav Ofir

    Hi Alex, for this purpose you can use something like:
    1. List all of your resources using the listResources() method.
    Here's an example from the git repo: https://github.com/cloudinary/CloudinaryDotNet/blob/master/Cloudinary.Test/CloudinaryTest.cs#L800
    2. Iterate over the list of resources, extract the folder from its public-ids (usually requires omitting the characters which follow the last slash).
    3. Tag the resource using the extracted folder name, for example:
    https://github.com/cloudinary/CloudinaryDotNet/blob/master/Cloudinary.Test/CloudinaryTest.cs#L671

  • Avatar
    Alex Caldas

    Nadav, success!

    Thanks for this C# file, I has everything I need ;)

  • Avatar
    Ajit Singh

    there is no property called resource_type in TagParams class

    https://github.com/cloudinary/CloudinaryDotNet/blob/master/Cloudinary/Actions/TagParams.cs

    please suggest how to tag videos using dot net library

  • Avatar
    Nadav Ofir

    Dotnet libraries are currently going under refactoring & enhancement process. Meantime, as this is an open-source library, you can feel free to make changes to the relevant class and add missing parameters to it.
    We'll be happy to provide guidance on that topic.

Powered by Zendesk