appdotnet / api-spec

App.net API Documentation is on the web at https://developers.app.net. Source for these docs is in the new-docs branch here. Please use the issue tracker and submit pull requests! Help us build the real-time social service where users and developers come first, not advertisers.
https://developers.app.net
950 stars 99 forks source link

Suggestion: allow base64 encoded images #3

Open rgerard opened 12 years ago

rgerard commented 12 years ago

For the image object, it would be nice to allow small images to just send back their base64 encoding, as opposed to the URL. Something like this:

"16s": { "height": 16, "width": 16, "base64": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1woICQIzztyOYgAAAHVJREFUeNpj/P//f3t7OwNuICwsnJaWBueyQKjExABcGjZtOhwWFrZq1SoUDRISmrjtOLxq1Sq4HiYGIkBYWBicZCGoOi0tzcjIiIGBoauriygNDAwMJiYmcDZRTkIGoxpoogEacWfPniVBw/nz58+fP0+kBgCxLR/Dk4eUOQAAAABJRU5ErkJggg==" },

In a project I worked on a while back, we had to fetch tons of small images from urls. We instead started sending down the base64 encoding instead of the url, which saved us a round-trip in fetching the image. For a small image like this (16 x 16), the extra bandwidth to send the encoded text is negligible compared to the cost of opening another http request and pulling down the image.

fields commented 11 years ago

No, I didn't. I used the number 3 in a comment and it put in this reference.