I am reading images from a db, each image is composed by small images (3 or more). So, I am trying to printout with a loop:
res.writeHead(200, {'content-type':'text/html'});
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('./routes/mytiles.mbtiles');
var sql = "SELECT images.tile_data FROM images, map WHERE images.tile_id = map.tile_id AND map.zoom_level = 14 AND map.tile_column = 14125";
db.each(sql, function(err, row) {
console.log(row.tile_data);
res.write('<img src="data:image/jpg;base64,'+row.tile_data+'"> ');
});
db.close();
But, in the browser I only got ascii code (just like when you open a image file with a text editor). How can I solve his?
Thanks