I am debugging a PHP application that handles image resources. I would like to see the output ($dst_image as per the PHP manual’s jargon), but the code is not in a place that I could simply output it to the browser. Would the best debugging procedure be to write $dst_image to a file, and to load that file in the browser? Any other ideas?
Thanks.
See Example #1 and #2,
imagejpegwill output the jpeg data.You need to do few tings:
header('Content-Type: image/jpeg');At the end you should end up with something like this:
If you find your self in a situation where current request outputs data and you cannot output image… You can inject the base64 encoded image data into the HTML by using
<img src="data:image/jpeg;base64,..." />. See php documentation on base64_encode for images.