[ActiveStorage] Possible to override storage preview for custom service?

Hi folks,

I’m testing out Rails 5.2.0.rc1 and decided to dive in by creating an activestorage service for Dropbox.

A project I’m working on requires the upload of files to the Dropbox platform which I’ve successfully achieved.

Dropbox provides it’s own preview images for a vast number of file types (e.g. PSD, PNG, JPG, Sketch etc).

I was wondering how I might go about extending/overriding the attachment previewer to use and return a URL from the Dropbox API if they have one?

Thanks for any advice you might have.

Best,

Rikki

Ah ha, this looks promising:

https://github.com/rails/rails/blob/master/activestorage/app/models/active_storage/preview.rb