php生成水印,包括位置和透明度(3)
return false;
}
// 裁剪图片
if($cut == 0){ // 等比列
$scale = min($new_w/$old_w, $new_h/$old_h); // 计算缩放比例
$width = (int)($old_w*$scale); // 缩略图尺寸
$height = (int)($old_h*$scale);
$start_w = $start_h = 0;
$end_w = $old_w;
$end_h = $old_h;
} elseif($cut == 1){ // center center 裁剪
$scale1 = round($new_w/$new_h,2);
$scale2 = round($old_w/$old_h,2);
if($scale1 > $scale2){
$end_h = round($old_w/$scale1,2);
$start_h = ($old_h-$end_h)/2;
$start_w = 0;
$end_w = $old_w;
} else{
$end_w = round($old_h*$scale1,2);
相关新闻>>
- 发表评论
-
- 最新评论 更多>>