Add image conversion and resizing support in channel attachments #36

Merged
retoor merged 1 commits from BordedDev/snek:feat/image-conversion-resizing into main 2025-05-13 18:19:57 +02:00
Contributor

There are a bunch of changes:

  • Fix uvloop on windows
  • Adds url, strikthrough and spoiler plugin to markdown
  • Tweaks image embed conversion to also check mimetype
  • Changed the upload message from defaulting to being a image to url instead
  • Added enricher for <img> in messages
    • Limited to snek hosted files by checking if the url starts with /
      • Probably worth to check if the referrer and base url match and if they do make them valid for upgrading as well, or some other whitelist system e.g. [img](https://snek.molodetz.nl/channel/attachment/a24b0d09-bb52-4537-aed6-5be4b47fbd46/image.png) should convert as well
    • It converts to <picture>
    • It always adds a webp image as a fallback
    • Can be used to target sizes as well, that way a smaller file can be served if the image is only a small part
  • Added image conversion and resizing support to the attachment url
  • These are:
    • Format, the new format the image should be in
    • Width, scale the image down based on width, keeping aspect ratio
    • Height, scale the image down based on height, keeping aspect ratio
    • Width & height, scale the image down based on either width or height, which ever makes the smallest image while keeping aspect ratio

Extra formatting changes are most likely from IDE running black/formatting automatically

There are a bunch of changes: - Fix uvloop on windows - Adds url, strikthrough and spoiler plugin to markdown - Tweaks image embed conversion to also check mimetype - Changed the upload message from defaulting to being a image to url instead - Added enricher for \<img> in messages - Limited to snek hosted files by checking if the url starts with / - Probably worth to check if the referrer and base url match and if they do make them valid for upgrading as well, or some other whitelist system e.g. `[img](https://snek.molodetz.nl/channel/attachment/a24b0d09-bb52-4537-aed6-5be4b47fbd46/image.png)` should convert as well - It converts to \<picture> - It always adds a webp image as a fallback - Can be used to target sizes as well, that way a smaller file can be served if the image is only a small part - Added image conversion and resizing support to the attachment url - These are: - Format, the new format the image should be in - Width, scale the image down based on width, keeping aspect ratio - Height, scale the image down based on height, keeping aspect ratio - Width & height, scale the image down based on either width or height, which ever makes the smallest image while keeping aspect ratio Extra formatting changes are most likely from IDE running black/formatting automatically
BordedDev added 1 commit 2025-05-12 12:59:50 +02:00
retoor approved these changes 2025-05-13 18:19:52 +02:00
retoor merged commit ac2f68f93f into main 2025-05-13 18:19:57 +02:00
Sign in to join this conversation.
No reviewers
No Label
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: retoor/snek#36
No description provided.