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:
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 That's it.
(Editor: