Add upload previews #14

Closed
opened 2025-07-21 11:08:00 +00:00 by BlakeRain · 0 comments
BlakeRain commented 2025-07-21 11:08:00 +00:00 (Migrated from github.com)

It would be nice to add previews for uploads. This can be done in a worker process that receives notifications of new uploads and generates previews for this uploads. We can then include the preview in the upload view.

The preview generation worker should run in a separate task and have an MPSC queue on which it can receive notification of new uploads. The worker will then process all the preview generation. The worker can also periodically check to see if any uploads need to have a preview generated for them.

Generation of previews is a complex topic that is far beyond the scope of this little app. So I think I'll use some command line tools that can be installed into the Docker container alongside Parcel. These tools can be things like ImageMagick and Poppler.

Note: I don't think I need to worry about licensing, as this project itself is highly permissive, and I'm just going to be installing these dependencies in a Docker image.

To know how to generate a preview for a file we'll need a way of configuring the previewers. I think a JSON file in an etc directory will suffice. The JSON file can provide a correspondence between a MIME type and a series of commands to execute to generate the preview.

I'll need to ascertain the MIME type of an upload. There are a few crates that seem to do the job, but they appear to be either unmaintained or lacking matchers for common office formats. I think it might be easier to just use the file command 😁

It would be nice to add previews for uploads. This can be done in a worker process that receives notifications of new uploads and generates previews for this uploads. We can then include the preview in the upload view. The preview generation worker should run in a separate task and have an MPSC queue on which it can receive notification of new uploads. The worker will then process all the preview generation. The worker can also periodically check to see if any uploads need to have a preview generated for them. Generation of previews is a complex topic that is far beyond the scope of this little app. So I think I'll use some command line tools that can be installed into the Docker container alongside Parcel. These tools can be things like ImageMagick and Poppler. **Note:** I don't think I need to worry about licensing, as this project itself is highly permissive, and I'm just going to be installing these dependencies in a Docker image. To know how to generate a preview for a file we'll need a way of configuring the previewers. I think a JSON file in an `etc` directory will suffice. The JSON file can provide a correspondence between a MIME type and a series of commands to execute to generate the preview. I'll need to ascertain the MIME type of an upload. There are a few crates that seem to do the job, but they appear to be either unmaintained or lacking matchers for common office formats. I think it might be easier to just use the `file` command 😁
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
BlakeRain/parcel#14
No description provided.