{"id":21380,"date":"2016-05-25T15:01:59","date_gmt":"2016-05-25T15:01:59","guid":{"rendered":"http:\/\/dynamically_generating_zip_files_with_one_line_of_code"},"modified":"2025-03-02T15:26:54","modified_gmt":"2025-03-02T23:26:54","slug":"dynamically_generating_zip_files_with_one_line_of_code","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code","title":{"rendered":"How to Zip Photos Dynamically With a Single Line of Code"},"content":{"rendered":"<div class=\"wp-block-cloudinary-markdown \"><p>As a developer, you want to allow your users to download multiple files in a single click. An easy way to download multiple files and share them is to generate a ZIP file. When images are involved, you may also want to normalize the original images before including them in the ZIP file, by scaling them down to the same maximum resolution or converting them to the same format.<\/p>\n<p>For users who are not developers or for situations where a simple, manual method is preferred, there are straightforward ways to zip photos on platforms like Windows PC and iPhone. On a Windows PC, users can select files, right-click and choose to compress them into a zipped folder. Similarly, iPhone users can use the Files app to navigate to their photos, select them, and compress them.<\/p>\n<p>While manual and user-driven, these methods provide a simple and immediate way to compress files without the need for programming or API integration. However, they lack the automation, scalability, and advanced features like image normalization that a developer-centric solution offers.<\/p>\n<p>In the following simple example, 3 images of cats have been uploaded to the cloud.<\/p>\n<div style=\"text-align:center;\">\n<span style=\"display:inline-block;font-weight:bold;\">\n<a href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/fat_cat.jpg\" target =\"_blank\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200\/fat_cat.jpg\" alt=\"fat_cat.jpg\" title=\"fat_cat.jpg\" style=\"margin-right: 10px;display:block;\" \/><\/a>\nfat_cat\n<\/span>\n<span style=\"display:inline-block;font-weight:bold;\">\n<a href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/kitten.jpg\" target =\"_blank\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200\/kitten.jpg\" alt=\"kitten.jpg\" title=\"kitten.jpg\" style=\"margin-right: 20px;display:block;\" \/><\/a>\nkitten\n<\/span>\n<span style=\"display:inline-block;font-weight:bold;\">\n<a href=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/hungry_cat.jpg\" target =\"_blank\"><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/demo\/image\/upload\/w_200\/hungry_cat.jpg\" alt=\"hungry_cat.jpg\" title=\"hungry_cat.jpg\" style=\"display:block;\"\/><\/a>\nhungry_cat\n<\/span>\n<\/div>\n<p>With one line of code, you can generate a dynamic URL that, for example, automatically creates and then delivers a ZIP file containing the cat images, all scaled down to a width of 200 pixels (<em>this is just a sample URL<\/em>):<\/p>\n<p><code>https:\/\/api.cloudinary.com\/v1\\_1\/demo\/image\/generate\\_archive?api\\_key=373364719177799&amp;expires\\_at=1557919777&amp;mode=download&amp;public\\_ids%5B%5D=fat\\_cat&amp;public\\_ids%5B%5D=kitten&amp;public\\_ids%5B%5D=hungry\\_cat&amp;signature=a2f86b73d32d2a778493d6759d59059d0a30076d&amp;timestamp=1464179836&amp;transformations=c\\_scale%2Cw\\_200<\/code><\/p>\n<p>The ability to dynamically generate and deliver ZIP files to your users by including one line of code can be useful for developers in a number of ways. For example:<\/p>\n<ul>\n<li>Social and messaging apps that allow users to select multiple files to send to another recipient, who subsequently receives all the files in one ZIP file (e.g., the Gmail feature where you can download all attachments as a single ZIP file).<\/li>\n<li>Applications that include image galleries and allow users to select multiple images and then download a ZIP file with all the selected images (e.g., as Google Photos has implemented).<\/li>\n<li>Allowing your users to download multiple images simultaneously in a single ZIP file, where all the images have been normalized to a certain size, format or quality, (or any other <a href=\"\/documentation\/image_transformations\">image transformation<\/a> you want to apply to all the images).<\/li>\n<\/ul>\n<h2>Generating ZIP files of images in the cloud<\/h2>\n<p>Cloudinary supports generating ZIP files using the <code>generate_archive<\/code> <a href=\"https:\/\/cloudinary.com\/documentation\/image_upload_api_reference\">Upload API<\/a> method, which can include any type of file, and offers various options for determining which files to include in the ZIP file (e.g., according to the file\u2019s name, all files in the same folder, etc). The method also allows you to apply transformations to all the images before including them in the file and set various options for generating the ZIP file (e.g., naming the file). For more information on all the options available for generating ZIP files, see the <a href=\"https:\/\/cloudinary.com\/documentation\/image_upload_api_reference#generate_archive\">generate_archive documentation<\/a>.<\/p>\n<p>Cloudinary enables you to create and deliver ZIP files in one of the following two ways:<\/p>\n<ul>\n<li>Pre-create the ZIP file and upload it to the cloud.<\/li>\n<li>Generate a dynamic URL for creating and downloading a ZIP file on demand.<\/li>\n<\/ul>\n<p>The Cloudinary SDKs wrap the <code>generate_archive<\/code>  API method and provide 2 separate methods that accomplish these two goals.<\/p>\n<h3>Create a ZIP file of images<\/h3>\n<p>To pre-create a ZIP file, use the <code>create_zip<\/code> SDK method, which also automatically uploads the ZIP file to the cloud, and then gives your users a link for downloading it. This option is best if multiple users will be downloading the resulting ZIP file.<\/p>\n<p>For example, to create a ZIP file called <code>small_cats.zip<\/code> that contains small (50&#215;50) thumbnails of all of the images in your account that have been <a href=\"https:\/\/cloudinary.com\/documentation\/managing_assets\">tagged<\/a> as \u201ccats\u201d:<\/p>\n<cld-code-widget\n      class=\" c-code-widget\"\n      snippets=\"[{&quot;sdkId&quot;:&quot;ruby&quot;,&quot;framework&quot;:&quot;ruby&quot;,&quot;language&quot;:&quot;ruby&quot;,&quot;displayName&quot;:&quot;Ruby&quot;,&quot;packageName&quot;:&quot;cloudinary&quot;,&quot;packageVersion&quot;:&quot;2.x&quot;,&quot;packageStatus&quot;:&quot;&quot;,&quot;rawCodeSnippet&quot;:&quot;Cloudinary::Uploader.create_zip(:tags =&gt; &#039;cats&#039;, \\n\\t:resource_type =&gt; &#039;image&#039;, :target_public_id =&gt; &#039;small_cats.zip&#039;,\\n\\t:transformations =&gt; {:width =&gt; 50, :height =&gt; 50, :crop =&gt; :fill})&quot;,&quot;codeSnippet&quot;:&quot;Cloudinary::Uploader.create_zip(:tags =&gt; &#039;cats&#039;, \\n\\t:resource_type =&gt; &#039;image&#039;, :target_public_id =&gt; &#039;small_cats.zip&#039;,\\n\\t:transformations =&gt; {:width =&gt; 50, :height =&gt; 50, :crop =&gt; :fill})&quot;},{&quot;sdkId&quot;:&quot;php&quot;,&quot;framework&quot;:&quot;php&quot;,&quot;language&quot;:&quot;php&quot;,&quot;displayName&quot;:&quot;PHP&quot;,&quot;packageName&quot;:&quot;cloudinary_php&quot;,&quot;packageVersion&quot;:&quot;1.x&quot;,&quot;packageStatus&quot;:&quot;legacy&quot;,&quot;rawCodeSnippet&quot;:&quot;\\\\Cloudinary\\\\Uploader::create_zip(array(\\n\\t&#039;tags&#039; =&gt; &#039;cats&#039;, &#039;resource_type&#039; =&gt; &#039;image&#039;, \\n\\t&#039;target_public_id&#039; =&gt; &#039;small_cats.zip&#039;, &#039;transformations&#039; =&gt; array(\\n\\t\\t&#039;width&#039; =&gt; 50, &#039;height&#039; =&gt; 50, &#039;crop&#039; =&gt; &#039;fill&#039;)));&quot;,&quot;codeSnippet&quot;:&quot;\\\\Cloudinary\\\\Uploader::create_zip(array(\\n\\t&#039;tags&#039; =&gt; &#039;cats&#039;, &#039;resource_type&#039; =&gt; &#039;image&#039;, \\n\\t&#039;target_public_id&#039; =&gt; &#039;small_cats.zip&#039;, &#039;transformations&#039; =&gt; array(\\n\\t\\t&#039;width&#039; =&gt; 50, &#039;height&#039; =&gt; 50, &#039;crop&#039; =&gt; &#039;fill&#039;)));&quot;},{&quot;sdkId&quot;:&quot;python&quot;,&quot;framework&quot;:&quot;python&quot;,&quot;language&quot;:&quot;python&quot;,&quot;displayName&quot;:&quot;Python&quot;,&quot;packageName&quot;:&quot;cloudinary&quot;,&quot;packageVersion&quot;:&quot;1.x&quot;,&quot;packageStatus&quot;:&quot;&quot;,&quot;rawCodeSnippet&quot;:&quot;cloudinary.uploader.create_zip(\\n\\ttags = &#039;cats&#039;, resource_type = &#039;image&#039;, \\n\\ttarget_public_id = &#039;small_cats.zip&#039;, transformations = {\\n\\t\\twidth = 50, height = 50, crop =&gt; &#039;fill&#039;})&quot;,&quot;codeSnippet&quot;:&quot;cloudinary.uploader.create_zip(\\n\\ttags = &#039;cats&#039;, resource_type = &#039;image&#039;, \\n\\ttarget_public_id = &#039;small_cats.zip&#039;, transformations = {\\n\\t\\twidth = 50, height = 50, crop =&gt; &#039;fill&#039;})&quot;},{&quot;sdkId&quot;:&quot;nodejs&quot;,&quot;framework&quot;:&quot;nodejs&quot;,&quot;language&quot;:&quot;javascript&quot;,&quot;displayName&quot;:&quot;Node.js&quot;,&quot;packageName&quot;:&quot;cloudinary&quot;,&quot;packageVersion&quot;:&quot;2.x&quot;,&quot;packageStatus&quot;:&quot;&quot;,&quot;rawCodeSnippet&quot;:&quot;cloudinary.v2.uploader.create_zip(\\n\\t{ tags: &#039;cats&#039;, resource_type: &#039;image&#039;, \\n\\ttarget_public_id: &#039;small_cats.zip&#039;, transformations: {\\n\\t\\twidth: 50, height: 50, crop: &#039;fill&#039;}},\\n\\tfunction(error,result) {console.log(result) });&quot;,&quot;codeSnippet&quot;:&quot;cloudinary.v2.uploader.create_zip(\\n\\t{ tags: &#039;cats&#039;, resource_type: &#039;image&#039;, \\n\\ttarget_public_id: &#039;small_cats.zip&#039;, transformations: {\\n\\t\\twidth: 50, height: 50, crop: &#039;fill&#039;}},\\n\\tfunction(error,result) {console.log(result) });&quot;},{&quot;sdkId&quot;:&quot;java&quot;,&quot;framework&quot;:&quot;java&quot;,&quot;language&quot;:&quot;java&quot;,&quot;displayName&quot;:&quot;Java&quot;,&quot;packageName&quot;:&quot;cloudinary&quot;,&quot;packageVersion&quot;:&quot;2.x&quot;,&quot;packageStatus&quot;:&quot;&quot;,&quot;rawCodeSnippet&quot;:&quot;cloudinary.uploader().createZip(\\n\\tObjectUtils.asMap(&#039;tags&#039;, &#039;cats&#039;, &#039;resource_type&#039;, &#039;image&#039;,\\n\\t&#039;target_public_id&#039;, &#039;small_cats.zip&#039;, &#039;transformations&#039;, \\n\\tArrays.asList(\\n\\t\\tnew Transformation().width(50).height(50).crop(&#039;fill&#039;)));&quot;,&quot;codeSnippet&quot;:&quot;cloudinary.uploader().createZip(\\n\\tObjectUtils.asMap(&#039;tags&#039;, &#039;cats&#039;, &#039;resource_type&#039;, &#039;image&#039;,\\n\\t&#039;target_public_id&#039;, &#039;small_cats.zip&#039;, &#039;transformations&#039;, \\n\\tArrays.asList(\\n\\t\\tnew Transformation().width(50).height(50).crop(&#039;fill&#039;)));&quot;},{&quot;sdkId&quot;:&quot;curl&quot;,&quot;framework&quot;:&quot;curl&quot;,&quot;language&quot;:&quot;curl&quot;,&quot;displayName&quot;:&quot;cURL&quot;,&quot;packageName&quot;:&quot;&quot;,&quot;packageVersion&quot;:&quot;&quot;,&quot;packageStatus&quot;:&quot;&quot;,&quot;rawCodeSnippet&quot;:&quot;curl https:\\\/\\\/api.cloudinary.com\\\/v1_1\\\/demo\\\/image\\\/generate_archive -X POST --data &#039;tags=cats$resource_type=image&amp;target_public_id=small_cats.zip&amp;timestamp=173719931&amp;api_key=436464676&amp;signature=a788d68f86a6f868af&amp;transformations=c_fill%2Cw_50%2Ch_50&#039;&quot;,&quot;codeSnippet&quot;:&quot;curl https:\\\/\\\/api.cloudinary.com\\\/v1_1\\\/demo\\\/image\\\/generate_archive -X POST --data &#039;tags=cats$resource_type=image&amp;target_public_id=small_cats.zip&amp;timestamp=173719931&amp;api_key=436464676&amp;signature=a788d68f86a6f868af&amp;transformations=c_fill%2Cw_50%2Ch_50&#039;&quot;}]\"\n      parsed-url=\"[]\"\n      with-url=\"false\"\n    >\n      <span class=\"u-visually-hidden\">Loading code examples<\/span>\n    <\/cld-code-widget>\n<p>The response to the API call includes all pertinent information about the created zip file, including the URL needed to access it, in this case:<\/p>\n<p><a href=\"https:\/\/res.cloudinary.com\/demo\/raw\/upload\/small_cats.zip\">https:\/\/res.cloudinary.com\/demo\/raw\/upload\/small_cats.zip<\/a><\/p>\n<h3>Generate a dynamic URL for downloading a ZIP file on demand<\/h3>\n<p>Instead of pre-creating the ZIP file, you can generate a signed URL for creating a ZIP file on-the-fly and on-demand with the <code>download_archive_url<\/code> method of the Utils API. The ZIP file is created and streamed to your user only when the URL is accessed. The resulting ZIP file is not cached or stored in your Cloudinary account, so this option is best if only a single user downloads the resulting ZIP file and avoids waste if the URL is not accessed by the user.<\/p>\n<p>For example, to generate a signed URL for creating and delivering a ZIP file that contains the \u2018fat_cat\u2019 and \u2018kitten\u2019 images:<\/p>\n<cld-code-widget\n      class=\" c-code-widget\"\n      snippets=\"[{&quot;sdkId&quot;:&quot;ruby&quot;,&quot;framework&quot;:&quot;ruby&quot;,&quot;language&quot;:&quot;ruby&quot;,&quot;displayName&quot;:&quot;Ruby&quot;,&quot;packageName&quot;:&quot;cloudinary&quot;,&quot;packageVersion&quot;:&quot;2.x&quot;,&quot;packageStatus&quot;:&quot;&quot;,&quot;rawCodeSnippet&quot;:&quot;Cloudinary::Utils.download_zip_url(\\n\\t:public_ids =&gt; [&#039;fat_cat&#039;, &#039;kitten&#039;], \\n\\t:resource_type =&gt; &#039;image&#039;)&quot;,&quot;codeSnippet&quot;:&quot;Cloudinary::Utils.download_zip_url(\\n\\t:public_ids =&gt; [&#039;fat_cat&#039;, &#039;kitten&#039;], \\n\\t:resource_type =&gt; &#039;image&#039;)&quot;},{&quot;sdkId&quot;:&quot;php&quot;,&quot;framework&quot;:&quot;php&quot;,&quot;language&quot;:&quot;php&quot;,&quot;displayName&quot;:&quot;PHP&quot;,&quot;packageName&quot;:&quot;cloudinary_php&quot;,&quot;packageVersion&quot;:&quot;1.x&quot;,&quot;packageStatus&quot;:&quot;legacy&quot;,&quot;rawCodeSnippet&quot;:&quot;\\\\Cloudinary\\\\Utils::download_zip_url(\\n\\tarray(\\n\\t\\t&#039;public_ids&#039; =&gt; array(&#039;fat_cat&#039;, &#039;kitten&#039;), \\n\\t\\t&#039;resource_type&#039; =&gt; &#039;image&#039;));&quot;,&quot;codeSnippet&quot;:&quot;\\\\Cloudinary\\\\Utils::download_zip_url(\\n\\tarray(\\n\\t\\t&#039;public_ids&#039; =&gt; array(&#039;fat_cat&#039;, &#039;kitten&#039;), \\n\\t\\t&#039;resource_type&#039; =&gt; &#039;image&#039;));&quot;},{&quot;sdkId&quot;:&quot;python&quot;,&quot;framework&quot;:&quot;python&quot;,&quot;language&quot;:&quot;python&quot;,&quot;displayName&quot;:&quot;Python&quot;,&quot;packageName&quot;:&quot;cloudinary&quot;,&quot;packageVersion&quot;:&quot;1.x&quot;,&quot;packageStatus&quot;:&quot;&quot;,&quot;rawCodeSnippet&quot;:&quot;cloudinary.utils.download_zip_url(\\n\\tpublic_ids = [&#039;fat_cat&#039;, &#039;kitten&#039;], \\n\\tresource_type = &#039;image&#039;)&quot;,&quot;codeSnippet&quot;:&quot;cloudinary.utils.download_zip_url(\\n\\tpublic_ids = [&#039;fat_cat&#039;, &#039;kitten&#039;], \\n\\tresource_type = &#039;image&#039;)&quot;},{&quot;sdkId&quot;:&quot;nodejs&quot;,&quot;framework&quot;:&quot;nodejs&quot;,&quot;language&quot;:&quot;javascript&quot;,&quot;displayName&quot;:&quot;Node.js&quot;,&quot;packageName&quot;:&quot;cloudinary&quot;,&quot;packageVersion&quot;:&quot;2.x&quot;,&quot;packageStatus&quot;:&quot;&quot;,&quot;rawCodeSnippet&quot;:&quot;cloudinary.v2.utils.download_zip_url(\\n\\t{ public_ids: [&#039;fat_cat&#039;, &#039;kitten&#039;], resource_type: &#039;image&#039;},\\n\\tfunction(error,result) {console.log(result) });&quot;,&quot;codeSnippet&quot;:&quot;cloudinary.v2.utils.download_zip_url(\\n\\t{ public_ids: [&#039;fat_cat&#039;, &#039;kitten&#039;], resource_type: &#039;image&#039;},\\n\\tfunction(error,result) {console.log(result) });&quot;},{&quot;sdkId&quot;:&quot;java&quot;,&quot;framework&quot;:&quot;java&quot;,&quot;language&quot;:&quot;java&quot;,&quot;displayName&quot;:&quot;Java&quot;,&quot;packageName&quot;:&quot;cloudinary&quot;,&quot;packageVersion&quot;:&quot;2.x&quot;,&quot;packageStatus&quot;:&quot;&quot;,&quot;rawCodeSnippet&quot;:&quot;cloudinary.utils().downloadZipUrl(\\n\\tObjectUtils.asMap(&#039;public_ids&#039;, Arrays.asList(&#039;fat_cat&#039;, &#039;kitten&#039;), \\n\\t\\t&#039;resource_type&#039;, &#039;image&#039;));&quot;,&quot;codeSnippet&quot;:&quot;cloudinary.utils().downloadZipUrl(\\n\\tObjectUtils.asMap(&#039;public_ids&#039;, Arrays.asList(&#039;fat_cat&#039;, &#039;kitten&#039;), \\n\\t\\t&#039;resource_type&#039;, &#039;image&#039;));&quot;},{&quot;sdkId&quot;:&quot;curl&quot;,&quot;framework&quot;:&quot;curl&quot;,&quot;language&quot;:&quot;curl&quot;,&quot;displayName&quot;:&quot;cURL&quot;,&quot;packageName&quot;:&quot;&quot;,&quot;packageVersion&quot;:&quot;&quot;,&quot;packageStatus&quot;:&quot;&quot;,&quot;rawCodeSnippet&quot;:&quot;curl https:\\\/\\\/api.cloudinary.com\\\/v1_1\\\/demo\\\/image\\\/generate_archive -X POST --data &#039;public_ids[]=fat_cat&amp;public_ids[]=kitten$resource_type=image&amp;mode=download&amp;timestamp=173719931&amp;api_key=436464676&amp;signature=a788d68f86a6f868af&#039;&quot;,&quot;codeSnippet&quot;:&quot;curl https:\\\/\\\/api.cloudinary.com\\\/v1_1\\\/demo\\\/image\\\/generate_archive -X POST --data &#039;public_ids[]=fat_cat&amp;public_ids[]=kitten$resource_type=image&amp;mode=download&amp;timestamp=173719931&amp;api_key=436464676&amp;signature=a788d68f86a6f868af&#039;&quot;}]\"\n      parsed-url=\"[]\"\n      with-url=\"false\"\n    >\n      <span class=\"u-visually-hidden\">Loading code examples<\/span>\n    <\/cld-code-widget>\n<p>The API call returns the URL needed to dynamically create and deliver the ZIP file, in this case:<\/p>\n<h2>Dynamic ZIP files with a single line of code<\/h2>\n<p>Generating ZIP files with a single line of code allows you to organize, streamline, normalize and optimize multiple image delivery to your users. Either create the ZIP file and upload it to the cloud, or generate a dynamic URL that creates and delivers the ZIP file on demand. For more information on all the options available for generating ZIP files, see the <a href=\"https:\/\/cloudinary.com\/documentation\/image_upload_api_reference#generate_archive\">generate_archive documentation<\/a>. The feature is available for use with all Cloudinary accounts, including the <a href=\"https:\/\/cloudinary.com\/users\/register_free\">free tier<\/a>.<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":41,"featured_media":21381,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[25,91,92,165,176,214,229,257],"class_list":["post-21380","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-asset-management","tag-django","tag-dotnet","tag-image-transformation","tag-java","tag-node","tag-php","tag-ruby-on-rails"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.6 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Zip Photos Dynamically With a Single Line of Code<\/title>\n<meta name=\"description\" content=\"Learn how to facilitate multiple file download and sharing by automatically generating a ZIP archive of image files and offering a URL for download by users\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Zip Photos Dynamically With a Single Line of Code\" \/>\n<meta property=\"og:description\" content=\"Learn how to facilitate multiple file download and sharing by automatically generating a ZIP archive of image files and offering a URL for download by users\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-05-25T15:01:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-02T23:26:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1649724739\/Web_Assets\/blog\/zip_generation_in_the_cloud\/zip_generation_in_the_cloud-jpg?_i=AA\" \/>\n\t<meta property=\"og:image:width\" content=\"500\" \/>\n\t<meta property=\"og:image:height\" content=\"281\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"NewsArticle\",\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"How to Zip Photos Dynamically With a Single Line of Code\",\"datePublished\":\"2016-05-25T15:01:59+00:00\",\"dateModified\":\"2025-03-02T23:26:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code\"},\"wordCount\":11,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649724739\/Web_Assets\/blog\/zip_generation_in_the_cloud\/zip_generation_in_the_cloud.jpg?_i=AA\",\"keywords\":[\"Asset Management\",\"Django\",\"DotNet\",\"Image Transformation\",\"Java\",\"Node\",\"PHP\",\"Ruby on Rails\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2016\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code\",\"url\":\"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code\",\"name\":\"How to Zip Photos Dynamically With a Single Line of Code\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649724739\/Web_Assets\/blog\/zip_generation_in_the_cloud\/zip_generation_in_the_cloud.jpg?_i=AA\",\"datePublished\":\"2016-05-25T15:01:59+00:00\",\"dateModified\":\"2025-03-02T23:26:54+00:00\",\"description\":\"Learn how to facilitate multiple file download and sharing by automatically generating a ZIP archive of image files and offering a URL for download by users\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649724739\/Web_Assets\/blog\/zip_generation_in_the_cloud\/zip_generation_in_the_cloud.jpg?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649724739\/Web_Assets\/blog\/zip_generation_in_the_cloud\/zip_generation_in_the_cloud.jpg?_i=AA\",\"width\":500,\"height\":281},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Zip Photos Dynamically With a Single Line of Code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"name\":\"Cloudinary Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudinary.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\",\"name\":\"Cloudinary Blog\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"width\":312,\"height\":60,\"caption\":\"Cloudinary Blog\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Zip Photos Dynamically With a Single Line of Code","description":"Learn how to facilitate multiple file download and sharing by automatically generating a ZIP archive of image files and offering a URL for download by users","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code","og_locale":"en_US","og_type":"article","og_title":"How to Zip Photos Dynamically With a Single Line of Code","og_description":"Learn how to facilitate multiple file download and sharing by automatically generating a ZIP archive of image files and offering a URL for download by users","og_url":"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code","og_site_name":"Cloudinary Blog","article_published_time":"2016-05-25T15:01:59+00:00","article_modified_time":"2025-03-02T23:26:54+00:00","og_image":[{"width":500,"height":281,"url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1649724739\/Web_Assets\/blog\/zip_generation_in_the_cloud\/zip_generation_in_the_cloud-jpg?_i=AA","type":"image\/jpeg"}],"twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code"},"author":{"name":"","@id":""},"headline":"How to Zip Photos Dynamically With a Single Line of Code","datePublished":"2016-05-25T15:01:59+00:00","dateModified":"2025-03-02T23:26:54+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code"},"wordCount":11,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649724739\/Web_Assets\/blog\/zip_generation_in_the_cloud\/zip_generation_in_the_cloud.jpg?_i=AA","keywords":["Asset Management","Django","DotNet","Image Transformation","Java","Node","PHP","Ruby on Rails"],"inLanguage":"en-US","copyrightYear":"2016","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code","url":"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code","name":"How to Zip Photos Dynamically With a Single Line of Code","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649724739\/Web_Assets\/blog\/zip_generation_in_the_cloud\/zip_generation_in_the_cloud.jpg?_i=AA","datePublished":"2016-05-25T15:01:59+00:00","dateModified":"2025-03-02T23:26:54+00:00","description":"Learn how to facilitate multiple file download and sharing by automatically generating a ZIP archive of image files and offering a URL for download by users","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649724739\/Web_Assets\/blog\/zip_generation_in_the_cloud\/zip_generation_in_the_cloud.jpg?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649724739\/Web_Assets\/blog\/zip_generation_in_the_cloud\/zip_generation_in_the_cloud.jpg?_i=AA","width":500,"height":281},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/dynamically_generating_zip_files_with_one_line_of_code#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Zip Photos Dynamically With a Single Line of Code"}]},{"@type":"WebSite","@id":"https:\/\/cloudinary.com\/blog\/#website","url":"https:\/\/cloudinary.com\/blog\/","name":"Cloudinary Blog","description":"","publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudinary.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cloudinary.com\/blog\/#organization","name":"Cloudinary Blog","url":"https:\/\/cloudinary.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","width":312,"height":60,"caption":"Cloudinary Blog"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":""}]}},"jetpack_featured_media_url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649724739\/Web_Assets\/blog\/zip_generation_in_the_cloud\/zip_generation_in_the_cloud.jpg?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/21380","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/comments?post=21380"}],"version-history":[{"count":5,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/21380\/revisions"}],"predecessor-version":[{"id":37104,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/21380\/revisions\/37104"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/21381"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=21380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=21380"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=21380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}