PHP uses streaming method to create thumbnails_PHP tutorial

WBOY
Release: 2016-07-15 13:23:22
Original
818 people have browsed it

Among them, db_mysql.inc.php, config.php and function.php are not really used. The key is the $filename file name. I read the image name in the database.

<p><?php <br>include_once ('inc/db_mysql.inc.php');<br>include_once ('inc/config.php');<br>include_once ('class/function.php');</p><p>global $picPath;</p><p>if (strstr($_SERVER[HTTP_USER_AGENT],"MSIE")) {<br>$attachment = '';<br>} else {<br>$attachment = ' atachment;';<br>}</p><p>$image = getInfo('newssp_gallery','id',$_GET['id']);</p><p>$filename = $picPath.$image['filename'];</p><p>if (!file_exists($filename)) {<br>$filename = $picPath."notexist.gif";<br>}</p><p>header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1<br>header("Cache-Control: post-check=0, pre-check=0", false);<br>header("Pragma: no-cache");// HTTP/1.0</p><p>header("Content-disposition:".$attachment." filename=".$image['original']);</p><p>$size = @filesize($filename);</p><p>header("Content-Length: $size");</p><p>$fd = @fopen($filename,rb);<br>$contents = @fread($fd,$size);<br>@fclose ($fd);</p><p>echo $contents;<br>?></p>
Copy after login

When using it, you can add it to the html file: PHP uses streaming method to create thumbnails_PHP tutorial

showpic.php and the above php file, id=xxx is the record ID in the database, width is the width of the thumbnail, and height is the thumbnail Height, please do not use both width and height at the same time. For example, if you want to implement a thumbnail with a width of 50, just PHP uses streaming method to create thumbnails_PHP tutorialThat's it.

(Editor:

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446847.htmlTechArticle Among them, db_mysql.inc.php, config.php, function.php are not really used, the key is $filename For the file name, I read the image name from the database. include_once ('inc/db_mysql...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template