So when we store a binary like say an image in a bytea column, say my_app.images.image, we can get a URL to that exact field's value with
endpoint.schema('my_app').table('images').rows('id',12345).then(function(image) {
var href = image.field('image').to_url();
});
Then href should contain the URL of that field's value. This works.
The mimetype of fields in this column can be set with endpoint.column_mimetype. The webserver looks up the column's mimetype and serves the resource accordingly. This works.
However, images aren't coming through properly due to some kind of encoding issue.
The resource is encoded in the database using encode(content,'escape'). Then the webserver converts it to base64 with a2b_base64().
So when we store a binary like say an image in a
bytea
column, saymy_app.images.image
, we can get a URL to that exact field's value withThen
href
should contain the URL of that field's value. This works.The mimetype of fields in this column can be set with
endpoint.column_mimetype
. The webserver looks up the column's mimetype and serves the resource accordingly. This works.However, images aren't coming through properly due to some kind of encoding issue.
The resource is encoded in the database using
encode(content,'escape')
. Then the webserver converts it tobase64
witha2b_base64()
.Something in this pipeline is not working.