最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

php 縮略圖實(shí)現(xiàn)函數(shù)代碼

 更新時(shí)間:2011年06月23日 22:30:11   作者:  
php 生成縮略圖函數(shù)非常簡單,只是調(diào)入了幾個GD的系統(tǒng)函數(shù),不過卻很實(shí)用
array getimagesize ( string $filename [, array &$imageinfo ] ) 取得圖像大小
resource imagecreatetruecolor ( int $x_size , int $y_size ) 新建一個真彩色圖像
resource imagecreatefromjpeg ( string $filename ) 從 JPEG 文件或 URL 新建一圖像
bool imagecopyresized ( resource $dst_image , resource $src_image , int $dst_x , int $dst_y , int $src_x , int $src_y , int $dst_w , int $dst_h , int $src_w , int $src_h ) 拷貝部分圖像并調(diào)整大小
bool imagejpeg ( resource $image [, string $filename [, int $quality ]] ) 以 JPEG 格式將圖像輸出到瀏覽器或文件
復(fù)制代碼 代碼如下:

<?php
/*
Created by <A >http://www.cnphp.info</A>
*/
// 文件及縮放尺寸
//$imgfile = 'smp.jpg';
//$percent = 0.2;
header('Content-type: image/jpeg');
list($width, $height) = getimagesize($imgfile);
$newwidth = $width * $percent;
$newheight = $height * $percent;
$thumb = ImageCreateTrueColor($newwidth,$newheight);
$source = imagecreatefromjpeg($imgfile);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagejpeg($thumb);
?>

相關(guān)文章

最新評論

区。| 武穴市| 铅山县| 清水县| 泰州市| 尤溪县| 凤凰县| 海兴县| 新竹市| 肥西县| 高尔夫| 德钦县| 宝丰县| 繁峙县| 巩留县| 三门峡市| 介休市| 博湖县| 社会| 翼城县| 化州市| 望城县| 宜黄县| 综艺| 故城县| 阳信县| 静海县| 阿坝县| 东港市| 增城市| 晋州市| 建德市| 资源县| 临潭县| 项城市| 嘉定区| 平顶山市| 安康市| 视频| 滨海县| 左贡县|