Closed scottbell closed 12 months ago
@scottbell to document how/why images are getting bigger post annotations. My current theory is when we annotate, we re-save the image much larger than the original.
@rukmini-bose found that an image that's 2MB in size goes to 4.9 MB after adding a circle, which points to the image library being a bit inefficient about encoding
I've added notifications & errors for:
I've also updated the README in the CouchDB plugin to describe how to up the documents limits. Basically:
[couchdb]
max_document_size = 4294967296 ; approx 4 GB
[chttpd]
max_http_request_size = 4294967296 ; approx 4 GB
as both the documents, and the HTTP server in front of CouchDB need to accept the new big limits.
I've also updated interaction with the entry to accept pasting of images, both in the text box, and if selecting the entry.
What I haven't done is intercept a CouchDB error when annotating an image that's become too big, as this happens during a mutation, which unfortunately isn't propagated all the way back. We could fix this by allowing mutate
in ObjectAPI
to return a Promise
, e.g.:
mutate(domainObject, path, value) {
this.#mutate(domainObject, path, value);
if (this.isTransactionActive()) {
return Promise.resolve(this.transaction.add(domainObject));
} else {
return this.save(domainObject);
}
}
and then catching it on the Notebook side, but this is touching some core Open MCT stuff, and would need @akhenry's blessing.
To test:
Also, try copy/pasting images into both the entry text, and just selecting the entry. It should create embeddings for you.
Verified fixed.
Is your feature request related to a problem? Please describe. When dropping an supported file onto a notebook entry (e.g., non-image or an image too big), tell the user it isn't supported - don't just silently fail.
Describe the solution you'd like Perhaps a notification that the embed didn't work because it wasn't the right type of file (an image), or it was too big.
Note that for the issue of an image being too big, this does not affect the initial import of the file into the entry, but rather when the user is doing some action with the image afterwards (i.e., annotating). When the image is annotated and saved, only then do we see errors coming from the console, which stop the annotations from persisting.