DEV: Improve `script/downsize_uploads.rb` (PR #13508)

  • Only shrink images that are used in Posts and no other models
  • Don’t save the upload if the size is the same


There is a very minor downside here in that our core codebase now includes a query only used in a script. Having said that, I think the ability to test it easier makes up for it.

The query is extracted from CleanUpUploads job so it kind of already was a part of the app. :slightly_smiling_face: