Ask: Use PHP function Fpassthru () to show the picture in detail, how to deal with

Source: Internet
Author: User
Ask: Use PHP's function fpassthru () to show the picture in detail
The idea of a newly-learned PHP may not have been asked, presumably in the sense that:

WAMP environment, Zend Framework +smarty templates

1. Then use Fpassthru to pass a picture in action to show if it is feasible? How to write?

2. Do not use the IMG tag with Fpassthru can pass the picture to the foreground?

------Solution--------------------
... action{
1 can directly output the picture content, for example, with your fpassthru:
PHP code
//open file in binary format $name = './img/ok.png ' $fp = fopen ($name, ' RB ');//Send the appropriate header header ("Content-type:image/png"); Header ("Content-length:"). FileSize ($name));//Send picture and Terminate script fpassthru ($FP); exit; 
------Solution--------------------
Apache under the anti-theft chain can be used rewrite_module, with these output file header method to deal with the server will only aggravate the burden.

http://sealbird.iteye.com/blog/976891
------Solution--------------------
discussion
upstairs yesterday i also searched, but tried, did not know where is the problem

the back of the ' RB ' should be the parameter bar this parameter I checked the manual not found so I want to ask to see if there is more useful information

------Solution--------------------
Comment out the header ("Content-length:". FileSize ($imgpath));

Header ("content-type:image/jpg");
, only the picture data stream
  • 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.