how to create a base64encoded string from image resource how to create a base64encoded string from image resource php php