added base64 image compressor function from Mathias Bynens