Storing image/binary data on model

We have a feedback form that allows a user to submit a support request or general app feedback. It is currently implemented with a model, and when the user hits submit, the model is created and saved via the store.

I’m looking at using something like html2canvas to grab a screenshot and attach it to the feedback model for submission. The image generation side is working fine, I’m wondering about whether it is practical to store and submit a binary blob as part of a regular ember model. I haven’t found any examples that step outside the simple string, date or number model attributes. Most image submission workflows center around more of a typical file upload by a user.

I guess a hybrid approach could be:

  • Generate a guid etc for the image
  • Upload the image and store it seperately, indexed by the guid
  • Attach the image guid to the feedback model, rather than the entire image blob

I’d like to keep the image closely tied to the feedback model so its easy to correlate the 2. Anyone doing something similar?

I am using ember-cli-file-picker to grab the image and store it. I’m fairly new to ember but the below link shows how I am managing it. The app is really just a playground but maybe it will give you some ideas.

https://github.com/cah-johnryan/Sodashop-TestFirst/blob/master/app/controllers/soda-brands/soda-brand/sodas/create.js