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 ) 拷貝部分映像並調整大小
bool imagejpeg ( resource $image [, string $filename [, int $quality ]] ) 以 JPEG 格式將映像輸出到瀏覽器或檔案
複製代碼 代碼如下:
/*
Created by http://www.cnphp.info
*/
// 檔案及縮放尺寸
//$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);
?>
以上就介紹了phison-up10量產工具v1.78.00 php 縮圖實現函數代碼,包括了phison-up10量產工具v1.78.00方面的內容,希望對PHP教程有興趣的朋友有所協助。