Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize entity thumbnail storage #364

Merged
merged 15 commits into from
Sep 30, 2024

Conversation

martastain
Copy link
Member

@martastain martastain commented Sep 27, 2024

This pull request introduces several enhancements and new functionalities to the thumbnail storage and retrieval system. The most important changes include adding support for original thumbnails, refactoring storage methods, and improving the cleanup process for unused thumbnails.

When an uploaded thumbnail is larger than a defined value (currently hardcoded 600px both width and height) the original is stored in the project storage (server/projects/{project_name}/thumbnails) and a scaled down version is saved to the DB for quick retrieval.

Tasks

  • save scaled down version of the image to the database, and the original to the project storage
  • support ?original=true in [GET] ..../thumbnail endpoints to retrieve the original image
  • implement file deletion in thumbnails cleaner process
  • implement "optimize thumbnails" background process that will be executed once (rest?) and handle older "large" thumbnails (separate PR?)

Description of changes

  • Added an original parameter to various thumbnail retrieval functions to fetch the original image from storage if available.
  • Introduced new methods in ProjectStorage for handling thumbnails, including storing, retrieving, and deleting thumbnail images.
  • Updated the clear_thumbnails function to improve the deletion process of old thumbnails, ensuring that only those not referenced in the database are removed.
  • Included detailed docstrings and comments for better code readability and maintenance.

These changes collectively enhance the robustness and functionality of the thumbnail management system, making it more efficient and easier to maintain.

@martastain martastain self-assigned this Sep 27, 2024
@martastain martastain linked an issue Sep 27, 2024 that may be closed by this pull request
@martastain martastain added the type: enhancement Improvement of existing functionality or minor addition label Sep 27, 2024
@martastain martastain marked this pull request as ready for review September 27, 2024 14:14
@martastain martastain merged commit d420aac into develop Sep 30, 2024
@martastain martastain deleted the 154-optimize-entity-thumbnail-storage branch October 21, 2024 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Improvement of existing functionality or minor addition
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimize entity thumbnail storage
1 participant