pull/18/head
icret 2019-06-15 00:46:00 +08:00
parent 00556ce721
commit 261e5af77c
2 changed files with 10 additions and 17 deletions

View File

@ -2,14 +2,6 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="b2ee2f11-40d4-43c6-9de2-9c41691ca848" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/.idea/EasyImages2.0.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/codeStyles/Project.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/codeStyles/codeStyleConfig.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/php.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/libs/WaterMask.php" beforeDir="false" afterPath="$PROJECT_DIR$/libs/WaterMask.php" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -28,8 +20,8 @@
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/libs/WaterMask.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="530">
<caret line="149" column="61" selection-start-line="149" selection-start-column="61" selection-end-line="149" selection-end-column="61" />
<state relative-caret-position="124">
<caret line="151" column="56" selection-start-line="151" selection-start-column="56" selection-end-line="151" selection-end-column="56" />
</state>
</provider>
</entry>
@ -51,10 +43,10 @@
<find>compress</find>
<find>imgcompress_percent</find>
<find>res</find>
<find>imagecreatetruecolor</find>
<find>def</find>
<find>imagecopy</find>
<find>imagecopyresampled</find>
<find>imagecreatetruecolor</find>
</findStrings>
</component>
<component name="Git.Settings">
@ -176,12 +168,12 @@
<workItem from="1560444856509" duration="3460000" />
<workItem from="1560511153119" duration="2276000" />
<workItem from="1560513441936" duration="8769000" />
<workItem from="1560528928873" duration="1113000" />
<workItem from="1560528928873" duration="1816000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="17758000" />
<option name="totallyTimeSpent" value="18461000" />
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1936" height="1066" extended-state="6" />
@ -283,8 +275,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/libs/WaterMask.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="530">
<caret line="149" column="61" selection-start-line="149" selection-start-column="61" selection-end-line="149" selection-end-column="61" />
<state relative-caret-position="124">
<caret line="151" column="56" selection-start-line="151" selection-start-column="56" selection-end-line="151" selection-end-column="56" />
</state>
</provider>
</entry>

View File

@ -59,6 +59,8 @@ class Imgs
# 创建画布
$temp_img = imagecreatetruecolor($temp_w, $temp_h);
@imagealphablending($temp_img,false);//这里很重要,意思是不合并颜色,直接用$img图像颜色替换,包括透明色;3-2
@imagesavealpha($temp_img,true);//这里很重要,意思是不要丢了$thumb图像的透明色;3-3
switch ($info[2]) {
case 1:
$im = imagecreatefromgif($src);
@ -72,6 +74,7 @@ class Imgs
break;
case 3:
$im = imagecreatefrompng($src);
imagesavealpha($im,true);//这里很重要;3-1
imagecopyresampled($temp_img, $im, 0, 0, 0, 0, $temp_w, $temp_h, $width, $height);
imagepng($temp_img, $savepath, 100);
break;
@ -147,12 +150,10 @@ 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: