FlightAware Discussions

MapFlight string not converting into a base64 image

when I try to use a MapFlight string as a base64 image…

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAA…

it is not rendering as an image. is there something I am missing here? is it in fact a base64 string?

It is base64, but the “data:image/png;base64” style of inline images requires the data to be reformatted as a single-line base64 and I think FlightXML returns multi-line base64 (ie: line-wrapped).

i’ve never encountered this before. do you know in JS/Node if there is a way to convert it?

Just remove the “\n” sequences in the data.

str = str.replace('\n', '');

thanks. yea i completely forgot about replace…