开发者身份允许用户单击下载多文件下载多文件分享的简单方式是生成ZIP文件图像卷入时,您还可能想先将原创图像归并ZIP文件,通过缩放至最大分辨率或转换为相同格式实现原创图像归并
币游国际真人娱乐非开发者用户或简单人工法优先使用时,有直接方法拉平WindowsPC和iPhone等平台上的照片WindowsPC用户可选择文件右键并选择压缩成拉链文件夹类似地,iPhone用户可使用文件应用浏览照片并选择照片并压缩
人工驱动法和用户驱动法为压缩文件提供简单即时方法,无需编程或API集成缺少自动化可扩缩性 和高级特征像图像正常化 开发者中心解决方案提供
下简单例子中 三幅猫影上传云
单行代码可生成动态URL,例如自动创建并交付包含猫图像的ZIP文件,全部缩放至200像素宽度这只是样本URL:
https://api.www.agrosoland.com/v1\_1/demo/image/generate\_archive?api\_key=373364719177799&expires\_at=1557919777&mode=download&public\_ids%5B%5D=fat\_cat&public\_ids%5B%5D=kitten&public\_ids%5B%5D=hungry\_cat&signature=a2f86b73d32d2a778493d6759d59059d0a30076d×tamp=1464179836&transformations=c\_scale%2Cw\_200
动态生成ZIP文件并提交用户的能力通过加入一行代码对开发者以多种方式有用例举 :
- 社交通讯应用允许用户选择多文件寄送另一接收者,后者随后从一个ZIP文件接收所有文件(例如Gmail特征,即所有附加文件都可按单ZIP文件下载)。
- 应用中包括图像画廊并允许用户选择多图像并下载带所有选择图像的ZIP文件(例如Google Photos实现后)。
- 允许用户同时下载多图像入单ZIP文件,所有图像都归并到一定大小、格式或质量上(或任何其他方面)图像变换需要应用到所有图像中) 。
云型支持生成ZIP文件generate_archive
上传a方法可以包括任何类型文件,并提供各种选项确定ZIP文件中应包含哪些文件(例如,根据文件名,同文件夹中所有文件等)。方法还允许您先对图像应用变换后再文件并设置生成ZIP文件的不同选项(例如命名文件)。关于生成ZIP文件所有选项的更多信息见生成文件.
Cloudinary使你能够以下列两种方式之一创建并交付ZIP文件:
- 预创建ZIP文件并上传云
- 生成动态URL按需创建并下载ZIP文件
云型SDK打包generate_archive
API方法提供2个独立方法实现这两个目标
预创ZIP文件使用创建_zip
SDK方法自动上传ZIP文件到云中,然后为用户提供下载链路最优选择是多用户下载生成ZIP文件
例举创建调用ZIP文件small_cats.zip
内存小图(50x50)缩略图贴上标签ascats:
'cats', \n\t:resource_type => 'image', :target_public_id => 'small_cats.zip',\n\t:transformations => {:width => 50, :height => 50, :crop => :fill})","codeSnippet":"Cloudinary::Uploader.create_zip(:tags => 'cats', \n\t:resource_type => 'image', :target_public_id => 'small_cats.zip',\n\t:transformations => {:width => 50, :height => 50, :crop => :fill})"},{"sdkId":"php","framework":"php","language":"php","displayName":"PHP","packageName":"cloudinary_php","packageVersion":"1.x","packageStatus":"legacy","rawCodeSnippet":"\\Cloudinary\\Uploader::create_zip(array(\n\t'tags' => 'cats', 'resource_type' => 'image', \n\t'target_public_id' => 'small_cats.zip', 'transformations' => array(\n\t\t'width' => 50, 'height' => 50, 'crop' => 'fill')));","codeSnippet":"\\Cloudinary\\Uploader::create_zip(array(\n\t'tags' => 'cats', 'resource_type' => 'image', \n\t'target_public_id' => 'small_cats.zip', 'transformations' => array(\n\t\t'width' => 50, 'height' => 50, 'crop' => 'fill')));"},{"sdkId":"python","framework":"python","language":"python","displayName":"Python","packageName":"cloudinary","packageVersion":"1.x","packageStatus":"","rawCodeSnippet":"cloudinary.uploader.create_zip(\n\ttags = 'cats', resource_type = 'image', \n\ttarget_public_id = 'small_cats.zip', transformations = {\n\t\twidth = 50, height = 50, crop => 'fill'})","codeSnippet":"cloudinary.uploader.create_zip(\n\ttags = 'cats', resource_type = 'image', \n\ttarget_public_id = 'small_cats.zip', transformations = {\n\t\twidth = 50, height = 50, crop => 'fill'})"},{"sdkId":"nodejs","framework":"nodejs","language":"javascript","displayName":"Node.js","packageName":"cloudinary","packageVersion":"1.x","packageStatus":"","rawCodeSnippet":"cloudinary.v2.uploader.create_zip(\n\t{ tags: 'cats', resource_type: 'image', \n\ttarget_public_id: 'small_cats.zip', transformations: {\n\t\twidth: 50, height: 50, crop: 'fill'}},\n\tfunction(error,result) {console.log(result) });","codeSnippet":"cloudinary.v2.uploader.create_zip(\n\t{ tags: 'cats', resource_type: 'image', \n\ttarget_public_id: 'small_cats.zip', transformations: {\n\t\twidth: 50, height: 50, crop: 'fill'}},\n\tfunction(error,result) {console.log(result) });"},{"sdkId":"java","framework":"java","language":"java","displayName":"Java","packageName":"cloudinary","packageVersion":"1.x","packageStatus":"","rawCodeSnippet":"cloudinary.uploader().createZip(\n\tObjectUtils.asMap('tags', 'cats', 'resource_type', 'image',\n\t'target_public_id', 'small_cats.zip', 'transformations', \n\tArrays.asList(\n\t\tnew Transformation().width(50).height(50).crop('fill')));","codeSnippet":"cloudinary.uploader().createZip(\n\tObjectUtils.asMap('tags', 'cats', 'resource_type', 'image',\n\t'target_public_id', 'small_cats.zip', 'transformations', \n\tArrays.asList(\n\t\tnew Transformation().width(50).height(50).crop('fill')));"},{"sdkId":"curl","framework":"curl","language":"curl","displayName":"cURL","packageName":"","packageVersion":"","packageStatus":"","rawCodeSnippet":"curl https:\/\/api.www.agrosoland.com\/v1_1\/demo\/image\/generate_archive -X POST --data 'tags=cats$resource_type=image&target_public_id=small_cats.zip×tamp=173719931&api_key=436464676&signature=a788d68f86a6f868af&transformations=c_fill%2Cw_50%2Ch_50'","codeSnippet":"curl https:\/\/api.www.agrosoland.com\/v1_1\/demo\/image\/generate_archive -X POST --data 'tags=cats$resource_type=image&target_public_id=small_cats.zip×tamp=173719931&api_key=436464676&signature=a788d68f86a6f868af&transformations=c_fill%2Cw_50%2Ch_50'"}]" parsed-url="[]" with-url="false" >
加载代码示例
API调用响应中包括所有与创建拉链文件有关的信息,包括访问文件需要的URL
https://res.www.agrosoland.com/demo/raw/upload/small_cats.zip
免预创ZIP文件,可生成签名URL创建ZIP文件download_archive_url
ivilsAPI方法ZIP文件仅在访问URL时创建并流送用户生成的ZIP文件不缓存或存储到您的云型账号中,所以这个选项最好只有单用户下载生成的ZIP文件并避免用户访问URL时出现垃圾
生成签名URL创建并交付ZIP文件
['fat_cat', 'kitten'], \n\t:resource_type => 'image')","codeSnippet":"Cloudinary::Utils.download_zip_url(\n\t:public_ids => ['fat_cat', 'kitten'], \n\t:resource_type => 'image')"},{"sdkId":"php","framework":"php","language":"php","displayName":"PHP","packageName":"cloudinary_php","packageVersion":"1.x","packageStatus":"legacy","rawCodeSnippet":"\\Cloudinary\\Utils::download_zip_url(\n\tarray(\n\t\t'public_ids' => array('fat_cat', 'kitten'), \n\t\t'resource_type' => 'image'));","codeSnippet":"\\Cloudinary\\Utils::download_zip_url(\n\tarray(\n\t\t'public_ids' => array('fat_cat', 'kitten'), \n\t\t'resource_type' => 'image'));"},{"sdkId":"python","framework":"python","language":"python","displayName":"Python","packageName":"cloudinary","packageVersion":"1.x","packageStatus":"","rawCodeSnippet":"cloudinary.utils.download_zip_url(\n\tpublic_ids = ['fat_cat', 'kitten'], \n\tresource_type = 'image')","codeSnippet":"cloudinary.utils.download_zip_url(\n\tpublic_ids = ['fat_cat', 'kitten'], \n\tresource_type = 'image')"},{"sdkId":"nodejs","framework":"nodejs","language":"javascript","displayName":"Node.js","packageName":"cloudinary","packageVersion":"1.x","packageStatus":"","rawCodeSnippet":"cloudinary.v2.utils.download_zip_url(\n\t{ public_ids: ['fat_cat', 'kitten'], resource_type: 'image'},\n\tfunction(error,result) {console.log(result) });","codeSnippet":"cloudinary.v2.utils.download_zip_url(\n\t{ public_ids: ['fat_cat', 'kitten'], resource_type: 'image'},\n\tfunction(error,result) {console.log(result) });"},{"sdkId":"java","framework":"java","language":"java","displayName":"Java","packageName":"cloudinary","packageVersion":"1.x","packageStatus":"","rawCodeSnippet":"cloudinary.utils().downloadZipUrl(\n\tObjectUtils.asMap('public_ids', Arrays.asList('fat_cat', 'kitten'), \n\t\t'resource_type', 'image'));","codeSnippet":"cloudinary.utils().downloadZipUrl(\n\tObjectUtils.asMap('public_ids', Arrays.asList('fat_cat', 'kitten'), \n\t\t'resource_type', 'image'));"},{"sdkId":"curl","framework":"curl","language":"curl","displayName":"cURL","packageName":"","packageVersion":"","packageStatus":"","rawCodeSnippet":"curl https:\/\/api.www.agrosoland.com\/v1_1\/demo\/image\/generate_archive -X POST --data 'public_ids[]=fat_cat&public_ids[]=kitten$resource_type=image&mode=download×tamp=173719931&api_key=436464676&signature=a788d68f86a6f868af'","codeSnippet":"curl https:\/\/api.www.agrosoland.com\/v1_1\/demo\/image\/generate_archive -X POST --data 'public_ids[]=fat_cat&public_ids[]=kitten$resource_type=image&mode=download×tamp=173719931&api_key=436464676&signature=a788d68f86a6f868af'"}]" parsed-url="[]" with-url="false" >
加载代码示例
API调回动态创建并交付ZIP文件所需的URL,在此例中:
生成单行代码ZIP文件允许组织化、精简化、规范化和优化多图像传送或创建ZIP文件并上传云或生成动态URL按需创建并交付ZIP文件关于生成ZIP文件所有选项的更多信息见生成文件.特征可用所有云式账号使用,包括自由级.