Home >Backend Development >PHP Tutorial >Reasons why dynamic thumbnails are not displayed in ie6_PHP tutorial

Reasons why dynamic thumbnails are not displayed in ie6_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:46:19832browse

When I upload and generate a thumbnail, the link displayed in the thumbnail is as follows;

Copy code The code is as follows:

< img src ="/index.php?action=sys_upload_showThumb&id=bdc3955470adfb5637a0d1f517eb3d35" />

As a result, the thumbnail is not displayed under ie6; it was later traced back to the following piece of code:
Copy code The code is as follows:

header("Content-type: image/jpeg");
header("Content-Length: ". strlen($_SESSION["fileInfo"][$image_id]));
echo $_SESSION["fileInfo"][$image_id];
unset($_SESSION['fileInfo'][$image_id]); //
exit(0);

So I wondered if it was unset before it was displayed? So the deletion was successful. Later it was changed to the following code:
Copy code The code is as follows:

header("Content-type: image/jpeg") ;
header("Content-Length: ".strlen($_SESSION["fileInfo"][$image_id]));
echo $_SESSION["fileInfo"][$image_id];
/* *Immediately output the above session to solve the problem that the thumbnails generated under IE6 have been cleared by the unset($_SESSION['']) below before they are displayed, resulting in IE6 being unable to display the thumbnails.*/
echo $str . str_repeat(' ', 256); //Some browsers must not output until the output reaches 256 characters
ob_flush();
flush( ); // These two must be used together
unset($_SESSION['fileInfo'][$image_id]); //
exit(0);

In fact, this This also leads to the issue of server output control and browser caching, which is a bit complicated. I will study it again when I have the opportunity.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320176.htmlTechArticleWhen I upload and generate a thumbnail, the link displayed in the thumbnail is as follows; Copy the code as follows: img src =" /index.php?action=sys_upload_showThumbgt; As a result, the thumbnail is not displayed under ie6;...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn