all images with multiple frames will store only the first frame as the preview
images will be cropped to a max size of 150 x 150 pixels and stored as .jpeg format
video (first frame only)
mp4
webm
gif
Generating Previews
Generating image previews will require an image manipulation library. Imageproc (made by the same group who developed the image manip library above) can write text to images. Check to see if I can use just one library instead of both image and imageproc.
Since manipulating preview images can take time we don't want the user to experience, it might be best to use rabbitmq to queue using lapin when uploads aren't happening. The queue won't have to take up space, because it can just reference the already-uploaded files. Running rabbit can take up extra memory though, so it should probably be under a feature flag, and possibly running on a different piece of hardware (use config file).
The previews will be stored as a BLOB in a new database table, with a reference to the original file's id for easy access via a rest handler
Checklist
[x] set up lapin + rabbitmq
[x] new database table for previews
[x] file id (int, pk)
[x] file preview (blob)
[x] add db methods
[x] create
[x] method
[x] tests
[x] read
[x] method
[x] tests
[x] delete
[x] method
[x] tests
[x] bind create method to lapin
[x] hook lapin up into create file in file_service
[x] hook db methods into file_service
[x] delete file deletes the file preview
[x] unit tests
[x] new endpoint to get file preview through file_service (/files/preview/:id)
[x] code
[ ] api tests
[x] new endpoint to get all file previews in a folder (/folders/preview/:id, non recursive)
[x] code
[ ] api tests
[x] update openapi
[x] file endpoint
[x] folder endpoint
[x] queue is not persisted to disk
[x] on boot, check db for flag. If unset, push all files to queue
For now we will only worry about images. office documents and pdfs aren't super useful for my use case right now and it's a pita to get it working cleanly.
File Previews
Goals
.jpeg
formatGenerating Previews
Generating image previews will require an image manipulation library. Imageproc (made by the same group who developed the image manip library above) can write text to images. Check to see if I can use just one library instead of both
image
andimageproc
.Since manipulating preview images can take time we don't want the user to experience, it might be best to use rabbitmq to queue using lapin when uploads aren't happening. The queue won't have to take up space, because it can just reference the already-uploaded files. Running rabbit can take up extra memory though, so it should probably be under a feature flag, and possibly running on a different piece of hardware (use config file).
The previews will be stored as a BLOB in a new database table, with a reference to the original file's id for easy access via a rest handler
Checklist
/files/preview/:id
)/folders/preview/:id
, non recursive)