Hi All Discoursians,
We’ve been self hosting for a few years with our own Discourse install and have built up a collection of about 30GB of image uploads on S3. Over that time we’ve changed our minds on what image file types to allow, plus what sort of original image upload size to support. New features have also been added to Discourse over the last 6 years or so that we didn’t have at the beginning, so the issue is mainly a lot of our older posts. The new browser-side composer resize is helping our storage needs a lot, and is working great.
My thinking is we’d like to convert and downsize all of our existing image uploads to JPG, to save storage costs. In searching around here I’ve found this:
…and thought about adapting it? The issue is that this would work for downsizing but not for any converting of formats, as in, it would reduce the original image size of a large PNG but keep it as a PNG, rather than convert it to a JPG with the new size.
It looks like I’d have to write my own version of this
…so before I do that I thought I should share what I was intending to do, and then someone might come along and say ‘Or you could do this really simple thing without writing that code…’ and make me happy.
Appreciate any ideas, red flags or comments. If I have to do a new rake script then I can share it back here if anyone else is in a similar sort of set-up to us.