php圖像處理函數imagecopyresampled各項參數意義詳解
語法
bool imagecopyresampled ( 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 )
參數
dst_image 目標圖象連接資源。
src_image 源圖象連接資源。
dst_x 目標 X 座標點。
dst_y 目標 Y 座標點。
src_x 源的 X 座標點。
src_y 源的 Y 座標點。
dst_w 目標寬度。
dst_h 目標高度。
src_w 源圖象的寬度。
src_h 源圖象的高度。
成功時返回 TRUE, 或者在失敗時返回 FALSE
案例
<?php
$targ_w = $targ_h = 150 ;
$jpeg_quality = 90 ;
$src = 'demo_files/pool.jpg' ;
$img_r = imagecreatefromjpeg ( $src ) ;
$dst_r = ImageCreateTrueColor ( $targ_w , $targ_h ) ;
imagecopyresampled ( $dst_r , $img_r , 0 , 0 , $_POST [ 'x' ] , $_POST [ 'y' ] ,
$targ_w , $targ_h , $_POST [ 'w' ] , $_POST [ 'h' ] ) ;
header ( 'Content-type: image/jpeg' ) ;
imagejpeg ( $dst_r , null , $jpeg_quality ) ;
?>