Closed
Bug 909648
Opened 11 years ago
Closed 11 years ago
Collections API for PUTing images should not require encoded parameter
Categories
(Marketplace Graveyard :: API, defect, P3)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: basta, Assigned: ashort)
Details
JSON encoding the body or URL encoding the body is expensive (especially if the image is more than a few hundred KB, which is almost a certainty for desktop-resolution images). Rather than requiring an "image" parameter, the API should simply accept the image as the request body (as a base64 string). This will eliminate garbage on the client and conceivably improve performance on the server as well (one fewer large decode operation to perform).
Assignee | ||
Comment 1•11 years ago
|
||
Glad you see it my way. Somebody should've said something on the original bug. :)
Assignee: nobody → ashort
Priority: -- → P3
Assignee | ||
Comment 2•11 years ago
|
||
The simplest thing seems to be just allowing a PUT of image/* data with no encoding. My understanding of file upload and XHR is that this isn't significantly harder to deal with from JS. Thoughts?
Reporter | ||
Comment 3•11 years ago
|
||
It's actually a bit of a pain in the ass without encoding because it requires raw access to the XHR, which our requests library doesn't give us out-of-the-box. Also, if we are going to do live preview/edit like mmaslaney talked about, we'll be doing it from a <canvas>, which means it will be significantly easier to get a data URI than it will be to twiddle an XHR to upload a raw file object.
Assignee | ||
Comment 4•11 years ago
|
||
then I'm not sure what this bug is about, since PUT to image/ expects a data URI right now.
Reporter | ||
Comment 5•11 years ago
|
||
Right now, according to the docs, the API expects something that looks like this: {"image":"data:image/png;base64,..."} when it should accept simply: data:image/png;base64,... There's no sense in putting it in a parameter.
Assignee | ||
Comment 6•11 years ago
|
||
Aha. Got it.
Assignee | ||
Comment 7•11 years ago
|
||
https://github.com/mozilla/zamboni/commit/2276eeb74
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•