Images that are uploaded from smartphones are commonly over 4MB in size (my max upload size is set to 5MB). I just took one of these images are dumped it into ImageOptim and the size dropped to under 800KB. I can’t tell the difference when viewing the pics.
It’s not impressive, but that’s besides the point. I’m simply asking if there’s a solution or some kind of work around. I tried lowering the allowable upload max image size, but then users can’t upload images from mobile devices at all (“your file is too big, yadda yadda”).
I though though that images get resized/compressed after initial upload, so you can even allow e.g. 10MB uploads, but limit max image width/height dimensions in your Settings.
There is definitely demand for further compression / pixel size limiting after upload.
Imho it should be allowed to upload big files but optimize / downsize them on the server after upload based on parameters from admin config.
Specifically for mobile uploads it would be beneficial to downsample them while keeping high quality / low compression (then to keep high res and compress photo with loss). Phone lenses are very low quality and even that there is high megapixel (usually it is just marketing) chip it doesn’t have any more pixel information than reasonably downsized photo.
Yes. For example, for our non-commercial community it tends to become vital. Every cent counts when no one is sponsoring… How much money we spend on the server, it mostly depend on how much space our current $20/mo DigitalOcean instance still have.
FYI: I recently re-worked our upload pipeline, which includes auto-converting large PNGs into (very) small JPEGs. You can fine tune the quality of the JPEGs with the “png to jpg quality” site setting.
The paint point here was very large uploaded PNGs which had absolutely no business being lossless PNGs, when they could be lossy JPGs at 1/5 or less the size. For small images (1280x720 or less) it does not matter so much, but get to 1080p++ and the cost becomes … extreme.
This also has super bad ramifications for PNG optimizers which take n2 or worse time as the image gets larger… here’s pngout.exe behavior by image size:
Yeah, larger res PNG’s are way bigger than JPEG’s. I am considering removing PNG’s from the approved files list; do any smartphones use PNG as the native capture format?
You shouldn’t need to worry, latest version of Discourse handles this perfectly and seamlessly. If Bad Users upload giant PNGs we auto-force-convert them as needed.
I know that it is probably not recommended approach, but I’d like to batch downsize uploads directory (original uploaded images not thumbnails) with external utility from bash. I’ve noticed that there is filesize column in uploads table so the question is: should I care about updating filesize field for each uploaded file that I’ll optimize outside of Discourse? Can I break something if not? From what I’ve found in sources uploads.filesize field is only used to display information in lightbox to user.
We need a proper custom script to do that, cause sha1 also should be updated and posts should be rebaked, optimized images need to be redone, it’s a pretty involved process