Created: 2019-08-13 Tue 23:18
A Logo Query contains a set of logo versions.
Our backend identifies them by an URL that resolves with a PNG of that logo version.
The URL and the PNG is controlled by Logograb (our logo detection provider).
We show the logo versions in various places in Analytics, also in the chart exports.
Though the PNGs used by Logograb are not optimized for displaying, especially not on a whitish background.
Detect whitish logos in the client and add a dark background if it’s a whitish logo.
Detection runs every single time a logo is shown.
It runs on the client.
We couldn’t make it work in certain places, especially in highcharts and obviously exported charts.
Move the detection and conversion to the server.
Browser caches converted image.
Client stays slim.
We can just use an image URL in the frontend and chart export service.
Requested logos are cached only in memory.
Not seperate
Frontend was moved to CDN while this happend.
Cloudfront seemed to support what we needed: execute some JS when the response of an origin came back, so we could place detection and conversion before returning it to the client and storing it in the CDN.
Turns out no way even access on the body, so no way to detect nor modify that body. :(
CDN directs logo URL calls directly to a cloud function.
We use bw-cloud-functions to implement conversion and detection.
Re-used detection and conversion we already wrote in JS in the 2nd try.
Super easy deployment
Still makes it’s way into the CDN store
Well, we misunderstood how a CDN actually works. It’s NOT a storage as it removes content that is not requested often enough in a region, so just a very small TTL in the cache.
To be fair, it’s not too bad the costs for all logo versions we currently get is still pretty low and does not really justify to spend more time on it.
Use cloud storage to store converted images and check there first, before doing a fetch, detect an maybe do a conversion dance.
Created by Thomas.