feat: configurable image downscaling upon upload#5184
Closed
FloDwld wants to merge 4 commits intousememos:mainfrom
Closed
feat: configurable image downscaling upon upload#5184FloDwld wants to merge 4 commits intousememos:mainfrom
FloDwld wants to merge 4 commits intousememos:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds configurable image downscaling functionality for uploaded attachments. Images exceeding a configurable maximum dimension are automatically downscaled before storage, with customizable JPEG quality settings. The feature is disabled by default (value 0) and can be configured through the web interface's Storage settings.
- Adds four new storage configuration fields:
imageMaxSize,jpegQuality,thumbnailMaxSize, andthumbnailJpegQuality - Implements image downscaling logic that preserves aspect ratios and original format (PNG/JPEG)
- Updates storage settings UI with new configuration inputs and validation
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| proto/store/workspace_setting.proto | Defines new storage setting fields for image processing configuration |
| proto/api/v1/workspace_service.proto | Adds API-level storage setting fields for image downscaling |
| proto/gen/store/workspace_setting.pb.go | Generated protobuf code for store-level storage settings |
| proto/gen/api/v1/workspace_service.pb.go | Generated protobuf code for API-level workspace service |
| proto/gen/api/v1/user_service.pb.go | Minor formatting change in generated code comment |
| proto/gen/openapi.yaml | OpenAPI spec updates reflecting new storage configuration fields |
| web/src/types/proto/api/v1/workspace_service.ts | TypeScript types for new storage settings |
| web/src/components/Settings/StorageSection.tsx | UI components for configuring image downscaling settings |
| store/workspace_setting.go | Default values and initialization for new storage settings |
| server/router/api/v1/workspace_service.go | Converts storage settings between API and store representations |
| server/router/api/v1/attachment_service.go | Implements image downscaling logic during attachment creation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds functionality to automatically downscale large JPEG and PNG images before they are stored in their respective storage location. The maximum size and quality are configurable via the web interface's Storage configuration.
By default, downscaling is deactivated (default value 0).
I'm sorry for the large amount of diffs due to the newly generated protobuf files. If you have any tips how to reduce the differences during protobuf generation, I'm happy to implement these.
As always, happy to hear your feedback.