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/dictionaries/hqs.xml b/.idea/dictionaries/hqs.xml
new file mode 100644
index 0000000..8c0237a
--- /dev/null
+++ b/.idea/dictionaries/hqs.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..8dac11b
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Blade files
+
+
+
+
+
+
\ 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..797f966
--- /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
new file mode 100644
index 0000000..d805691
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,214 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ imagepng
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ C:\Users\hqs\AppData\Roaming\Subversion
+
+
+
+
+ 1560571921743
+
+
+ 1560571921743
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/config.php b/config.php
index 90a58ef..326e29f 100644
--- a/config.php
+++ b/config.php
@@ -66,9 +66,13 @@ $config = array(
'waterImg' => 'public/static/watermark.png',
// 转换图片为指定格式 可选:''|'png'|'jpeg'|'gif'|'bmp';默认值:''
'imgConvert' => '',
- // 是否通过缩放来压缩,如果要保持源图比例,把参数$percent保持为1,范围 0.1-1
+ // 是否通过缩放来压缩,如果要保持源图比例,把参数$percent保持为1,范围 0.1-1 0为关闭
// 即使原比例压缩,也可大幅度缩小。如果缩小比例,则体积会更小。
- 'compress' => 0.95,
+ 'compress' => 0.99,
+ // gif和jpeg的压缩质量 压缩等级0-100,压缩后1最小,100最大
+ 'imgGifJpgWebp'=> 85,
+ // png的压缩质量 压缩等级0-9,压缩后9最小,0最大
+ 'imagepng' => 3,
//最大宽度
'maxWidth' => 10240,
// 最大高度
diff --git a/file.php b/file.php
index cea5928..2860f5f 100644
--- a/file.php
+++ b/file.php
@@ -104,28 +104,28 @@ if ($handle->uploaded) {
imagefill($dst_im, 0, 0, $bg);
imagesavealpha($dst_im, true);
- if ($handle->file_dst_name_ext === 'jpg') {
+ if ($handle->file_dst_name_ext === 'jpg' || $handle->file_dst_name_ext === 'jpeg') {
$src_im = imagecreatefromjpeg($handle->file_dst_pathname);
imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
- imagejpeg($dst_im, $handle->file_dst_pathname); //输出压缩后的图片
+ imagejpeg($dst_im, $handle->file_dst_pathname,$config['imgGifJpgWebp']); //输出压缩后的图片
imagedestroy($dst_im);
imagedestroy($src_im);
} elseif ($handle->file_dst_name_ext === 'png') {
$src_im = imagecreatefrompng($handle->file_dst_pathname);
imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
- imagepng($dst_im, $handle->file_dst_pathname); //输出压缩后的图片
+ imagepng($dst_im, $handle->file_dst_pathname,$config['imagepng']); //输出压缩后的图片
imagedestroy($dst_im);
imagedestroy($src_im);
} elseif ($handle->file_dst_name_ext === 'gif') {
$src_im = imagecreatefromgif($handle->file_dst_pathname);
imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
- imagegif($dst_im, $handle->file_dst_pathname); //输出压缩后的图片
+ imagegif($dst_im, $handle->file_dst_pathname,$config['imgGifJpgWebp']); //输出压缩后的图片
imagedestroy($dst_im);
imagedestroy($src_im);
} elseif ($handle->file_dst_name_ext === 'wbmp') {
$src_im = imagecreatefromwbmp($handle->file_dst_pathname);
imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
- imagewbmp($dst_im, $handle->file_dst_pathname); //输出压缩后的图片
+ imagewbmp($dst_im, $handle->file_dst_pathname,$config['imgGifJpgWebp']); //输出压缩后的图片
imagedestroy($dst_im);
imagedestroy($src_im);
}