I have a script that uses jQuery for POST data via AJAX for a PHP script that uses this data to create a dynamic JPG image. The PHP script returns binary image data as output using the image / jpeg command of the PHP header (how good it is).
Now I want to display this image in the client, but so far I have not been able to find a suitable solution for this. With a little thought, I realized that a possible solution would be for a PHP script to encode it in base64 and return the string to the client as a data URI. However, this solution is not enough because it is not supported by IE <8 and is still limited to 32K images in IE 8.
At the moment, I am writing an image to the temp directory on the server and returning the file name to the client. However, there should be another way to solve this problem more elegantly. Any tips on how I can use jQuery / JavaScript to display the returned binary image data in a browser?
Thanks!
source share