Compress uploaded images in Vanilla forum
Large images uploaded by forum users were clogging up my server. Rather than make changes to core vanilla code, I decided a simple solution would be to run a cron script that checks for "large" jpeg's, and compresses one image every 30 minutes.
This is the script I came up with.
I added these files to my public_html, and then added a run line to cron this command every 30 minutes:
I'm not an experienced php developer, so critical eyes and feedback are welcome, as there's the possibility I'm making big mistakes. This seemed like a simple solution to this issue for my server at least, and it freed up a lot of space, and the settings I've chosen have negligible compromise on image quality.
Hopefully this helps someone, or at least draws dev attention for a need for an integrated feature like this.