PHP _php tutorial for creating thumbnails with streaming methods

Source: Internet
Author: User
Where db_mysql.inc.php,config.php,function.php is not really used, the key is the $filename filename, which I read by reading the name of the picture in the database.
 

!--? php include_once (' inc/db_mysql.inc.php ');
Include_once (' inc/config.php ');
include_once (' class/function.php ');

Global $picPath;

If (Strstr ($_server[http_user_agent], "MSIE")) {
$attachment = ';
} else {
$attachment = ' atachment; ';
}

$image = getInfo (' newssp_gallery ', ' id ', $_get[' id ');

$filename = $picPath. $image [' filename '];

If (!file_exists ($filename)) {
$filename = $picPath. " Notexist.gif ";
}

Header ("Cache-control:no-store, No-cache, must-revalidate");//http/1.1
Header ("Cache-control: Post-check=0, pre-check=0 ", false);
Header ("Pragma:no-cache");//http/1.0

Header ("Content-disposition:". $attachment. "Filename=". $image [' original ']);

$size = @filesize ($filename);

Header ("Content-length: $size");

$FD = @fopen ($filename, RB);
$contents = @fread ($FD, $size);
@fclose ($FD);

Echo $contents;
?

In the use of the time can be added in the HTML file: 498) this.width=498; ' OnMouseWheel = ' javascript:return big (This) ' src= ' showpic.php?id=xxx ' width= ' Height= ' >

Showpic.php and the above PHP file, id=xxx is the database record id,width is the width of the thumbnail, height is the height of the thumbnail, please do not at the same time the width of the high, for example, you want to achieve a width of 50 thumbnails, as long as 498) this.width= 498, ' OnMouseWheel = ' javascript:return big (This) ' src= ' showpic.php?id=xxx ' width= ' > so that's it.

Editor

http://www.bkjia.com/PHPjc/446847.html www.bkjia.com true http://www.bkjia.com/PHPjc/446847.html techarticle where db_mysql.inc.php,config.php,function.php is not really used, the key is the $filename filename, which I read by reading the name of the picture in the database. Include_once (' Inc/db_mysql ...

  • Related Article

    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.