Tutorial: the fpassthru () function of PHP shows an image to explain how to learn PHP. it may not be asked, which means the following: wamp environment, zend Framework + smarty Template 1. & lt; imgsrc & quot; controlleraction parameter 1 parameter value & quot; & gt; is it feasible to use fpassthru to pass an image in the action to display it? How to write? 2. Tutorial: Use the fpassthru () function of PHP to show pictures
New PHP may not be asked, which is probably like this:
Wamp environment, zend Framework + smarty Template
1. Then, in the action, use fpassthru to pass an image to show whether it is feasible? How to write?
2. Can I use fpassthru to transmit images to the foreground without using the img tag?
------ Solution --------------------
... Action {
// 1 you can directly output the image content, for example, fpassthru you mentioned:
PHP code
// Open the file $ name = 'in binary format '. /img/OK .png '$ fp = fopen ($ name, 'RB'); // send the appropriate header ("Content-Type: image/png "); header ("Content-Length :". filesize ($ name); // send the image and terminate the script fpassthru ($ fp); exit;
------ Solution --------------------
Rewrite_module can be used for anti-Leech protection in apache. using these output file headers can only increase the server load.
Http://sealbird.iteye.com/blog/976891
------ Solution --------------------
Discussion
I also found it yesterday, but I tried it. I don't know where the problem is.
The following 'RB' should be a parameter. I have not found this parameter in the manual. so I 'd like to ask a question to see if there is more useful information.
------ Solution --------------------
Comment out the header ("Content-Length:". filesize ($ imgpath ));
Header ("Content-Type: image/jpg ");
Only image data streams