Skip to content

WIP to have feedback on enabling image sizes for LfsObjectUploader

Luke Duncalfe requested to merge WIP-LfsUploader-image-sizes into master

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 LfsObjectUploaders.

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:

  1. We only want LfsObjectUploader to generate versions for LfsObjects used by design management.
  2. We can use conditional versions but LfsObjects are relatively anonymous, in that there is no linkage between the LfsObject and the thing that created it (I can understand why), so making the conditional work isn't possible with any data the LfsObject has.

Approach to the solution in this WIP

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.

Thank you!

Edited by Luke Duncalfe

Merge request reports