diff --git a/.idea/EasyImages2.0.iml b/.idea/EasyImages2.0.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/EasyImages2.0.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..b3295c5 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..ad7b1b6 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..344530d --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 05a648f..d453974 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,8 +2,15 @@ - - + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -73,6 +53,8 @@ res imagecreatetruecolor def + imagecopy + imagecopyresampled @@ -193,18 +175,19 @@ - + + - - + @@ -266,13 +249,7 @@ - - - - - - - + @@ -299,15 +276,15 @@ - - + + - - + + diff --git a/libs/WaterMask.php b/libs/WaterMask.php index 1531168..cdef18f 100644 --- a/libs/WaterMask.php +++ b/libs/WaterMask.php @@ -130,8 +130,10 @@ class Imgs $srcImg_w = is_numeric($obj[0]) ? $obj[0] : 400; $srcImg_h = is_numeric($obj[1]) ? $obj[1] : 300; - # 创建画布 + # 创建透明画布 一共3个步骤,在下边有标记 $dst_img = @imagecreatetruecolor($srcImg_w, $srcImg_h); + @imagealphablending($dst_img,false);//这里很重要,意思是不合并颜色,直接用$img图像颜色替换,包括透明色;3-2 + @imagesavealpha($dst_img,true);//这里很重要,意思是不要丢了$thumb图像的透明色;3-3 } else { # 获取图片信息 $srcInfo = @getimagesize($src); @@ -145,14 +147,17 @@ class Imgs switch ($srcInfo[2]) { case 1: $dst_img = imagecreatefromgif($src); + imagesavealpha($dst_img,true);//这里很重要;3-1 break; case 2: $dst_img = imagecreatefromjpeg($src); + imagesavealpha($dst_img,true);//这里很重要;3-1 break; case 3: $dst_img = imagecreatefrompng($src); + imagesavealpha($dst_img,true);//这里很重要;3-1 break; default: