Question headers ('content-type: image/jpeg ') and imagejpeg ($ img) can output images, but they cannot output other contents at the same time, for example,
If imagejpeg ($ img, 'PATH') is used, save the image and then output it to refresh the webpage.
What can be done: on the same webpage, input parameters in a form, use GD2 to create an image, and then output the image on this page. keep the html content and do not refresh it.
I am a newbie and may have low levels of problems.
Reply to discussion (solution)
Imagejpeg ($ img, 'PATH ');
Echo '';
Try this way
Encapsulate the image you want to output separately, the path can be a http://www.example.com/action/method/
Add the image tag to the html output at the same time,
......
It seems that it can only be encapsulated. the method on the second floor must be refreshed to display the chart made of the input data on the current page.