Thumbnails for images and videos #87

Merged
Anna Sirota merged 28 commits from thumbnails into main 2024-04-25 17:50:58 +02:00
Owner

When an image or a video is uploaded and its initial scan comes back with an OK, thumbnails are generated for it.

In case the file is a video, a single frame is extracted from it with ffmpeg and used instead of File.source.

Thumbnails have predefined set of dimensions:

  • 1920 x 1080
  • 640 x 360 (for cards)

Thumbnails have fixed predefined locations in the storage, constructed from file hash, thumbnail's format (PNG) and dimensions:

thumbnails/{hash[:2]}/{hash}_{width}x{height}.png

After thumbnails are generated, these paths are saved in the File.metadata:

{
    "thumbnails": {
        "1080p": {"path": "thumbnails/de/deadbeef_1920x1080.png", "size": [1920, 1080]},
        "360p": {"path": "thumbnails/de/deadbeef_640x360.png", "size": [640, 360]}
    }
}

When original file is an image, the path of the largest thumbnail is saved in File.thumbnail column, when it's a video the extracted frame is stored in File.thumbnails instead.

When File is deleted all its thumbnails are deleted along with it.

Implements #51

Part of #70

When an image or a video is uploaded and its initial scan comes back with an OK, thumbnails are generated for it. In case the file is a video, a single frame is extracted from it with `ffmpeg` and used instead of `File.source`. Thumbnails have predefined set of dimensions: * 1920 x 1080 * 640 x 360 (for cards) Thumbnails have fixed predefined locations in the storage, constructed from file `hash`, thumbnail's format (PNG) and dimensions: ``` thumbnails/{hash[:2]}/{hash}_{width}x{height}.png ``` After thumbnails are generated, these paths are saved in the `File.metadata`: ``` { "thumbnails": { "1080p": {"path": "thumbnails/de/deadbeef_1920x1080.png", "size": [1920, 1080]}, "360p": {"path": "thumbnails/de/deadbeef_640x360.png", "size": [640, 360]} } } ``` When original file is an image, the path of the largest thumbnail is saved in `File.thumbnail` column, when it's a video the extracted frame is stored in `File.thumbnails` instead. When `File` is deleted all its thumbnails are deleted along with it. Implements https://projects.blender.org/infrastructure/extensions-website/issues/51 Part of https://projects.blender.org/infrastructure/extensions-website/issues/70
Anna Sirota added 2 commits 2024-04-22 19:03:04 +02:00
Anna Sirota added 1 commit 2024-04-22 19:03:21 +02:00
Anna Sirota added 1 commit 2024-04-23 13:37:52 +02:00
Anna Sirota added 1 commit 2024-04-23 14:52:47 +02:00
Anna Sirota changed title from WIP: Thumbnails for images to WIP: Thumbnails for image and video previews 2024-04-23 15:00:19 +02:00
Anna Sirota changed title from WIP: Thumbnails for image and video previews to WIP: Thumbnails for images and videos 2024-04-23 15:00:28 +02:00
Anna Sirota added 2 commits 2024-04-23 17:03:18 +02:00
Anna Sirota added 1 commit 2024-04-23 17:34:55 +02:00
Anna Sirota added 1 commit 2024-04-23 17:36:08 +02:00
Anna Sirota added 1 commit 2024-04-23 18:15:43 +02:00
Anna Sirota added 1 commit 2024-04-23 18:48:05 +02:00
Anna Sirota added 2 commits 2024-04-25 12:01:39 +02:00
Anna Sirota added 2 commits 2024-04-25 13:24:40 +02:00
Anna Sirota added 1 commit 2024-04-25 13:38:46 +02:00
Anna Sirota added 1 commit 2024-04-25 14:29:37 +02:00
Anna Sirota added 1 commit 2024-04-25 14:30:14 +02:00
Anna Sirota added 1 commit 2024-04-25 15:38:57 +02:00
Anna Sirota added 1 commit 2024-04-25 15:39:14 +02:00
Anna Sirota changed title from WIP: Thumbnails for images and videos to Thumbnails for images and videos 2024-04-25 15:39:43 +02:00
Anna Sirota added 1 commit 2024-04-25 15:55:08 +02:00
Anna Sirota added 1 commit 2024-04-25 16:01:08 +02:00
Anna Sirota added 2 commits 2024-04-25 16:51:11 +02:00
Anna Sirota added 1 commit 2024-04-25 16:52:48 +02:00
Anna Sirota added 1 commit 2024-04-25 17:09:46 +02:00
Anna Sirota added 1 commit 2024-04-25 17:29:09 +02:00
Anna Sirota added 1 commit 2024-04-25 17:48:28 +02:00
Oleg-Komarov approved these changes 2024-04-25 17:48:57 +02:00
Anna Sirota merged commit ad66ec6476 into main 2024-04-25 17:50:58 +02:00
Anna Sirota deleted branch thumbnails 2024-04-25 17:51:10 +02:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: infrastructure/extensions-website#87
No description provided.