How PHP uses headers to download images directly

Source: Internet
Author: User
How does PHP use the header to download images directly?
is not compressed package, but the picture format directly download, such as JPG, PNG format picture with the header function directly download, solve

------Solution--------------------
1, hit the header
2, output picture

No? PHP MANUAL:GD
------Solution--------------------
Search Content-disposition HTTP
PHP code
!--? php//We ll be outputting a PNG imageheader (' Con Tent-type:image/png ');//It'll be called Hello.pngheader (' content-disposition:attachment; filename= ' hello.png '); BR/-->------Solution--------------------
Direct download should be the header to jump to the URL of the image
the path to the sample is Http://test.com/pic/test1.jpg


Header ("location:http://test.com/pic/test1.jpg")
------solution to download--------------------
Explore

Direct download should be to jump to the URL of the image with the header
The path is http://test.com/pic/test1.jpg

to download
Header ("Location : Http://test.com/pic/test1.jpg ")

------Solution--------------------
But the landlord seems to want to download-,-I did not see, #2是真相 .
  • 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.