mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
修改图片上传问题
This commit is contained in:
parent
dec53f9ca9
commit
7ae13e77a7
6
vendor/composer/InstalledVersions.php
vendored
6
vendor/composer/InstalledVersions.php
vendored
@ -32,7 +32,7 @@ private static $installed = array (
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => 'f00305015a80eabe31474a75c9147214cb9d8585',
|
||||
'reference' => 'dec53f9ca9b07c3d9ce31ddaf6553b7c98c22389',
|
||||
'name' => 'zoujingli/thinkadmin',
|
||||
),
|
||||
'versions' =>
|
||||
@ -171,7 +171,7 @@ private static $installed = array (
|
||||
array (
|
||||
0 => '9999999-dev',
|
||||
),
|
||||
'reference' => '202f84ff3aabdc4cde3f8d1f0933a05cdd4d7172',
|
||||
'reference' => 'aaeb9dc81e7e93b6476460a9f58e752aa1e5f3ac',
|
||||
),
|
||||
'zoujingli/thinkadmin' =>
|
||||
array (
|
||||
@ -180,7 +180,7 @@ private static $installed = array (
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => 'f00305015a80eabe31474a75c9147214cb9d8585',
|
||||
'reference' => 'dec53f9ca9b07c3d9ce31ddaf6553b7c98c22389',
|
||||
),
|
||||
'zoujingli/wechat-developer' =>
|
||||
array (
|
||||
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
@ -849,12 +849,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
||||
"reference": "202f84ff3aabdc4cde3f8d1f0933a05cdd4d7172"
|
||||
"reference": "aaeb9dc81e7e93b6476460a9f58e752aa1e5f3ac"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/202f84ff3aabdc4cde3f8d1f0933a05cdd4d7172",
|
||||
"reference": "202f84ff3aabdc4cde3f8d1f0933a05cdd4d7172",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/aaeb9dc81e7e93b6476460a9f58e752aa1e5f3ac",
|
||||
"reference": "aaeb9dc81e7e93b6476460a9f58e752aa1e5f3ac",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -871,7 +871,7 @@
|
||||
"ext-mbstring": "*",
|
||||
"topthink/framework": "^6.0"
|
||||
},
|
||||
"time": "2021-05-12T08:50:33+00:00",
|
||||
"time": "2021-05-13T08:42:48+00:00",
|
||||
"default-branch": true,
|
||||
"type": "library",
|
||||
"extra": {
|
||||
|
6
vendor/composer/installed.php
vendored
6
vendor/composer/installed.php
vendored
@ -6,7 +6,7 @@
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => 'f00305015a80eabe31474a75c9147214cb9d8585',
|
||||
'reference' => 'dec53f9ca9b07c3d9ce31ddaf6553b7c98c22389',
|
||||
'name' => 'zoujingli/thinkadmin',
|
||||
),
|
||||
'versions' =>
|
||||
@ -145,7 +145,7 @@
|
||||
array (
|
||||
0 => '9999999-dev',
|
||||
),
|
||||
'reference' => '202f84ff3aabdc4cde3f8d1f0933a05cdd4d7172',
|
||||
'reference' => 'aaeb9dc81e7e93b6476460a9f58e752aa1e5f3ac',
|
||||
),
|
||||
'zoujingli/thinkadmin' =>
|
||||
array (
|
||||
@ -154,7 +154,7 @@
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => 'f00305015a80eabe31474a75c9147214cb9d8585',
|
||||
'reference' => 'dec53f9ca9b07c3d9ce31ddaf6553b7c98c22389',
|
||||
),
|
||||
'zoujingli/wechat-developer' =>
|
||||
array (
|
||||
|
2
vendor/services.php
vendored
2
vendor/services.php
vendored
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// This file is automatically generated at:2021-05-12 17:07:00
|
||||
// This file is automatically generated at:2021-05-13 16:43:36
|
||||
declare (strict_types = 1);
|
||||
return array (
|
||||
0 => 'think\\admin\\Library',
|
||||
|
@ -63,11 +63,11 @@ class ImageExtend
|
||||
*/
|
||||
private function _openImage(): array
|
||||
{
|
||||
[$width, $height, $type, $attr] = getimagesize($this->src);
|
||||
[$width, $height, $type] = getimagesize($this->src);
|
||||
if ($width < 1 || $height < 1) return [0, '读取图片尺寸失败!'];
|
||||
$this->imageinfo = ['width' => $width, 'height' => $height, 'attr' => $attr, 'type' => image_type_to_extension($type, false)];
|
||||
$this->imageinfo = ['width' => $width, 'height' => $height, 'type' => image_type_to_extension($type, false)];
|
||||
$fun = "imagecreatefrom{$this->imageinfo['type']}";
|
||||
$this->image = $fun($this->src);
|
||||
imagealphablending($this->image = $fun($this->src), true);
|
||||
return $this->_thumpImage();
|
||||
}
|
||||
|
||||
@ -76,13 +76,19 @@ class ImageExtend
|
||||
*/
|
||||
private function _thumpImage(): array
|
||||
{
|
||||
$newWidth = intval($this->imageinfo['width'] * $this->percent);
|
||||
$newHeight = intval($this->imageinfo['height'] * $this->percent);
|
||||
$imgThumps = imagecreatetruecolor($newWidth, $newHeight);
|
||||
// 将原图复制带图片载体上面,并且按照一定比例压缩,极大的保持了清晰度
|
||||
imagecopyresampled($imgThumps, $this->image, 0, 0, 0, 0, $newWidth, $newHeight, $this->imageinfo['width'], $this->imageinfo['height']);
|
||||
imagedestroy($this->image);
|
||||
$this->image = $imgThumps;
|
||||
[$srcWidth, $srcHeight] = [$this->imageinfo['width'], $this->imageinfo['height']];
|
||||
[$newWidth, $newHeight] = [intval($srcWidth * $this->percent), intval($srcHeight * $this->percent)];
|
||||
[$srcThumps, $dstBackup] = [imagecreatetruecolor($newWidth, $newHeight), imagecreatetruecolor($srcWidth, $srcHeight)];
|
||||
|
||||
[imagealphablending($srcThumps, false), imagesavealpha($srcThumps, true)];
|
||||
[imagealphablending($dstBackup, false), imagesavealpha($dstBackup, true)];
|
||||
|
||||
imagecopyresampled($srcThumps, $this->image, 0, 0, 0, 0, $newWidth, $newHeight, $srcWidth, $srcHeight);
|
||||
imagecopyresampled($dstBackup, $srcThumps, 0, 0, 0, 0, $srcWidth, $srcHeight, $newWidth, $newHeight);
|
||||
|
||||
[imagedestroy($srcThumps), imagedestroy($this->image)];
|
||||
|
||||
$this->image = $dstBackup;
|
||||
return [1, '图片压缩成功'];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user