Skip to content

feat: add Download All As dropdown for format-specific ZIP export - #15

Open
titoworlddev wants to merge 1 commit into
cloudinary-community:mainfrom
titoworlddev:feat/download-all-as
Open

feat: add Download All As dropdown for format-specific ZIP export#15
titoworlddev wants to merge 1 commit into
cloudinary-community:mainfrom
titoworlddev:feat/download-all-as

Conversation

@titoworlddev

Copy link
Copy Markdown

Description

Adds a "Download All As" dropdown button next to the existing "Download All" button, allowing users to export all optimized images in a specific format (AVIF, WebP, JPG, JXL) inside a single ZIP archive.

Previously, the "Download All" button always exported images in their original format (with auto-optimization). If you wanted all images converted to WebP, for example, you had to download them one by one using each individual result's "Download As" dropdown.

This new dropdown follows the same pattern as the existing per-result "Download As" UI and uses the pre-generated format-specific Cloudinary URLs that were already being created during optimization.

Bug fix included

Also fixes a bug where the original "Download All" button created ZIP entries with duplicate extensions (e.g., foto.png.png instead of foto.png), because the original filename (which already contains the extension) was being passed to the archive endpoint, which then appended the format again.

Changes

  • src/components/WidgetUpload/WidgetUpload.tsx:
    • Add DOWNLOAD_FORMATS constant
    • Add handleOnDownloadAllAs(targetFormat) function that sends format-specific URLs to the archive endpoint
    • Add dropdown UI with click-outside-to-close behavior (same pattern as per-result dropdown)
    • Fix duplicate extension in handleOnDownloadAll by stripping the extension from the filename before sending it to the archive endpoint

Add a 'Download All As' dropdown button next to 'Download All'
that lets users export all optimized images in a specific format
(AVIF, WebP, JPG, or JXL) inside a single ZIP archive.

Also fixes the duplicate file extension bug in 'Download All'
where ZIP entries were named 'foto.png.png' instead of 'foto.png'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant