Force conversion of images to WebP (or other efficient formats) on upload #865
Closed
barelyprofessional
started this conversation in
Ideas
Replies: 2 comments
-
|
seems like a good idea! i've got stuff in the works that should let you do this, as well as configure what format you want to use when compressing (jpeg, webp, jxl, even png compression idrk how it works but sharp takes care of it lol) along with this, it would probably be a good idea to let you configure what format video thumbnails are stored in, since it defaults to jpeg as well. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
now added, 95042e1...ac37f13 along with the thumbnail generation stuff i mentioned! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It'd be nice to have an option to force conversion of uploaded images to WebP or similar modern image formats (e.g. AVIF). Reason is that PNGs are unbelievably large and users with default ShareX configs will be filling the server up with these fatty PNGs as that's the default config.
For now I'm considering forcing image compression by injecting
x-zipline-image-compression-percentinto the user's HTTP request when it's not specified, but it'd be nice to have the option of maintaining lossless images while not having them be horrendously large.Edit: I've concocted a truly abominable "workaround". Basically using HAProxy I'm injecting the compression header but only if the form body has a .png file extension, with the option for the user to opt out using a special header.
This is how my HAProxy config looks if someone is interested in stealing this idea
Regarding
set-var, you probably don't need that for this exercise and can just look at the path in the request. The only reason I'm using it is because it is necessary to preserve the original path for deciding whether to send theCache-Controlheaders as zipline doesn't send these for images.The option
http-buffer-requestis necessary to inspect the request body but it'll have memory implications given you're telling HAProxy to wait for the whole request to come in before doing something. That being said, it wasn't as dramatic as I expected for my instance, HAProxy is using < 100 MB even when a large upload is happening.Beta Was this translation helpful? Give feedback.
All reactions