Answer the question
In order to leave comments, you need to log in
How to get a PHP-generated image via ajax request and make it a background image?
There is a code that generates an image and displays it in the browser. For example img.php:
header ("Content-type: image/png");
imagepng($thumb);
<div style="background-url:(http://site/img.php)"></div>
Answer the question
In order to leave comments, you need to log in
Get image, convert to data-uri, paste as background. stackoverflow.com/questions/20035615/using-raw-ima...
Are you sure that you need to get the image via ajax? Why are you not satisfied with the background-url, which does all this for you, and at the same time does not require the very best browsers?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question