<?php?
$srcFile="../images/logo.jpg";
$dstFile="des_big.jpg";
waterPic($dstFile,$srcFile,50);
function?waterPic($dstFile,$srcFile="../images/logo.jpg",$pct=30){
????$groundImg?=?$dstFile;
????$groundInfo?=?getimagesize($groundImg);
????$ground_w?=?$groundInfo[0];
????//print_r($groundInfo);
????$ground_h?=?$groundInfo[1];
????switch($groundInfo[2]){
????case?1:
????$ground_im?=?imagecreatefromgif($groundImg);
????break;
????case?2:
????$ground_im?=?imagecreatefromjpeg($groundImg);
????break;
????case?3:
????$ground_im?=?imagecreatefrompng($groundImg);
????break;
????}
????$waterImg?=?$srcFile;
????$imgInfo?=getimagesize($waterImg);
????$water_w?=?$imgInfo[0];
????$water_h?=?$imgInfo[1];
????switch($imgInfo[2]){
????case?1:
????$water_im?=?imagecreatefromgif($waterImg);
????break;
????case?2:
????$water_im?=?imagecreatefromjpeg($waterImg);
????break;
????case?3:
????$water_im?=?imagecreatefrompng($waterImg);
????break;
????}
????//?imagecopy($ground_im,$water_im,100,100,0,0,500,500);
????imagecopymerge($ground_im,?$water_im,?0,0,0,0,?$water_w,?$water_h,$pct);
????header("Content-type:?image/jpeg");
????imagejpeg($ground_im);
}
2017-09-16
全部代碼,上傳至 碼云保存,有需要的,鏈接地址,https://git.oschina.net/zhanfei3000/shopImooc.git
需要的,最好克隆,連著提交步驟都有
2017-09-16
自學IT網的回答,最好
