How can I get a base64 string from an image resource in PHP? Note however, I made the image on the fly, so no URL exists.
Here is what I've tried, but it doesn't work:
echo 'data:image/png;base64,'.base64_encode($img);
This gives an error:
Warning: base64_encode() expects parameter 1 to be string, resource given