PHP ??? ?? ?? ? ??? ??
?? ??? ??? ???? ???? ??? ?????. ???? ??? ???? ??? ?? ??? ?? ???? ?? ??? ?? ???? ? ??? ??? ????? ?????.
????? ???? ? ?? ??? ??? ????.
函數(shù)名 | 函數(shù)說明 |
---|---|
imagecopyresampled | 重采樣拷貝部分圖像并調(diào)整大小 |
imagecopyresized | 拷貝部分圖像并調(diào)整大小 |
? ? ?? ??? ???????. ? ? ?? ??? ???? ??? ????. ?? ????? ?? ??? ????. ??? ???? ?? ?? ?? ???? ????? ??? ?????.
bool imagecopyresampled(resource $ target image, Resource $ source image, int $ x ??? ???? ??, int $ y ??? ???? ?? , int $ source ?? x ??, int $ source ?? y ??, int $ ?? ??? ??, int $ ?? ??? ??, int $ ?? ??? ??, int $ ?? ??? ??)
?? ???? ?? ???? ????? ???? ??????.
bool imagecopyreized(resource $ target image, Resource $ source image, int $ target start x position, int $ target start y position, int $ source start x position, int $ source start y position, int $width of target image, int $height of target image, int $width of source image, int $height of source image)
??? ?? ?? ? ??? ??? ?????. ?, ???? ??? ? ?? ??? ????? ??? ??? ??? ????????.
?? ??:
?? ???? ???(x, y)?? ???? ???? ??? ??? ?????. ?? ???? ???(x, y)? ???? ???? ??? ??? ?????.
1. ???? ???? ???? ?????
1. ?? ???? ???
2. ??? ??(??/??) ??
3. ?? ???? ??? ??? ?? ??? ?????.
4. ?? ???
5 .??? ??? ?? ???? ??? ????
6. ???? ?????
Fan Bingbing ??? ?????:
<?php //打開來源圖片 $image = imagecreatefrompng('fbb.png'); //定義百分比,縮放到0.1大小 $percent = 0.1; // 將圖片寬高獲取到 list($width, $height) = getimagesize('fbb.png'); //設(shè)置新的縮放的寬高 $new_width = $width * $percent; $new_height = $height * $percent; //創(chuàng)建新圖片 $new_image = imagecreatetruecolor($new_width, $new_height); //將原圖$image按照指定的寬高,復(fù)制到$new_image指定的寬高大小中 imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); header('content-type:image/jpeg'); imagejpeg($new_image); ?>
2. ???? ??? ??? ?? ??? ????.
1. ?? ???? ?? ???? ???
2. ?? ???? ?? ???? ??? ??? ?????. ?? ???? ????. (???)
3. ??? ?? ? ??
4. ??? ??
?? ???? "degree"?? ??? ???? ???????. ??? ??:
??? ??:
??? ??:
????? ??? ?????.
degree? ?? ??? 407, 154???.
degree?? ??? x?? ????, ?? ??? ? y ??? ???: 80, 89
?? ? ??? ??? x, y ???: 281, 71
?? ? ??? ??? x, y ??? ??? ????. ??? ??? ??? 132, 160
??? ?? ??? ??, ??? ?? ????. ?? ???? ??? ??? ???? ???? ?????.
<?php $dst = imagecreatefrompng('hsq.png'); $src = imagecreatefrompng('du.png'); imagecopyresized($dst, $src, 281, 71, 407, 154, 132, 160, 80, 90); header('content-type:image/jpeg'); imagejpeg($dst); imagedestroy($dst); imagedestroy($src); ?>
??? ??? ???????: