base64_encode(): minimize buffer length for the base64 code