WIP to have feedback on enabling image sizes for LfsObjectUploader
Issue
We have a need to generate smaller image sizes for designs.
Problem
Design Management stores its data in Git and requires that Git LFS is enabled. This means all design files are LFS objects, and the files are represented by LfsObjectUploader
s.
It seems to me that the best way is to enable LfsObjectUploader
to handle image size versions. It's a regular Carrierwave uploader, so using Carrierwave to handle image versions is a natural fit.
The issues are:
- We only want
LfsObjectUploader
to generate versions forLfsObject
s used by design management. - We can use conditional versions but
LfsObject
s are relatively anonymous, in that there is no linkage between theLfsObject
and the thing that created it (I can understand why), so making the conditional work isn't possible with any data theLfsObject
has.
WIP
Approach to the solution in this The approach this WIP
has taken has been to allow the LfsObjectUploader
to have the app set a property on it that satisfies a condition. In order for the Uploader
to recognise the version when it outputs a URL or path, it needs to have the same property set also (i.e., both read and write situations need the conditional to be satisfied).
Note
I've left code in this MR that also exposes the image sizes in GraphQL so you have more context about the whole intention of the code.