I have a PHP script that generates an image with PHP GD. After it generates the image, it saves it, and send this output when called by Ajax:
imagejpeg($img_data
Here is solution:
PHP code:
ob_start(); imagejpeg($im); $outputBuffer = ob_get_clean(); $base64 = base64_encode($outputBuffer); echo '';
On user side (in JQuery):
success: function(data) { $('#somediv').append(data); }