How to get base64 string from database media object

Thanks very much @bridget, this works.