ODNZSL / nzsl-online

New Zealand Sign Language Dictionary
GNU General Public License v3.0
40 stars 11 forks source link

NZSL-51: Remove ImageProcessing from codebase #1477

Closed joshmcarthur closed 1 year ago

joshmcarthur commented 1 year ago

This pull request removes the image proxy code. While investigating how to refactor this code to work with Signbank assets, I realised that this proxy really isn't doing anything, since it no longer resizes. The caching used to be more important when resizing, since it would prevent us from having to transform an asset every time it was accessed.

Since we no longer do this, we are now downloading a file, transforming it to PNG (it's already a PNG), writing it to disk, and serving it. If the file is already cached ("cached" here meaning less than 24 hours old), it is read from disk and served. These operations all work fine, but are dependent on good network (which Heroku has), and good IO (which Heroku probably does not have).

Since assets are now on S3, we can achieve most likely better performance in terms of access time by linking directly to the asset in S3. This allows us to remove a bunch of code that no longer has much purpose, including our dependency on MiniMagic, and in turn, ImageMagick.

As I'm working to integrate Signbank dictionary data with this app, this change also makes the integration much simpler, since I can do the same thing with Signbank assets - link directly to them on S3.