Originally posted by RossC0
I cant save the image file and return the location as a string.
If you don't supply a filename parameter to imagepng(), it will be sent to the client instead. Just remember that (a) it is preceded by a 'Content-Type:image/png' header, and (b) the image is the only thing being sent; the script can't be sending any other output. So for example if you want to embed this image in an HTML page, you'd use the <img> tag, and the src= attribute would refer to the script that generates the image (probably with parameters in the querystring to specify what is to go in the image).
All that notwithstanding:
I need to return the binary (base64 encoded?) to the caller.
Putting the binary data of an image directly into an HTML page can be done, but the only browsers I know of where it works are Firefox and (I presume) others running the Gecko rendering engine.