How to use header and imagejpeg to output images

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.