Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
usedCarAuction
/
aus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 883fcf97
authored
May 11, 2026
by
章家宝
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixbug:阿里云上传图片的时候在图片后缀加上格式化参数
1 parent
e4da02fb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
aus-core/src/main/java/com/glsx/usedcar/storage/AliyunOssService.java
aus-core/src/main/java/com/glsx/usedcar/storage/AliyunOssService.java
View file @
883fcf9
...
@@ -5,12 +5,10 @@ import com.aliyun.oss.model.*;
...
@@ -5,12 +5,10 @@ import com.aliyun.oss.model.*;
import
jakarta.annotation.Nullable
;
import
jakarta.annotation.Nullable
;
import
net.coobird.thumbnailator.Thumbnails
;
import
net.coobird.thumbnailator.Thumbnails
;
import
net.coobird.thumbnailator.geometry.Positions
;
import
net.coobird.thumbnailator.geometry.Positions
;
import
org.apache.commons.lang3.RandomStringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.summerframework.storage.FileStorageException
;
import
org.summerframework.storage.FileStorageException
;
import
org.summerframework.storage.StorageService
;
import
org.summerframework.storage.domain.FileInfo
;
import
org.summerframework.storage.domain.FileInfo
;
import
org.summerframework.storage.platform.AbstractStorageService
;
import
org.summerframework.storage.platform.AbstractStorageService
;
...
@@ -285,8 +283,13 @@ public class AliyunOssService extends AbstractStorageService {
...
@@ -285,8 +283,13 @@ public class AliyunOssService extends AbstractStorageService {
// 执行上传
// 执行上传
ossClient
.
putObject
(
putObjectRequest
);
ossClient
.
putObject
(
putObjectRequest
);
Map
<
String
,
String
>
parameter
=
null
;
if
(
isImageFile
(
fileInfo
.
getName
()))
{
parameter
=
new
HashMap
<>();
parameter
.
put
(
"x-oss-process"
,
"image/format,jpg"
);
}
// 设置文件信息
// 设置文件信息
fileInfo
.
setUrl
(
getFileUrl
(
fileInfo
.
getFilePath
()));
fileInfo
.
setUrl
(
getFileUrl
(
fileInfo
.
getFilePath
()
,
null
,
parameter
));
// 获取文件大小
// 获取文件大小
OSSObject
ossObject
=
ossClient
.
getObject
(
bucketName
,
filePath
);
OSSObject
ossObject
=
ossClient
.
getObject
(
bucketName
,
filePath
);
...
@@ -295,7 +298,7 @@ public class AliyunOssService extends AbstractStorageService {
...
@@ -295,7 +298,7 @@ public class AliyunOssService extends AbstractStorageService {
String
thumbPath
=
this
.
thumbnails
(
fileInfo
.
getName
(),
filePath
);
String
thumbPath
=
this
.
thumbnails
(
fileInfo
.
getName
(),
filePath
);
if
(
StringUtils
.
isNotBlank
(
thumbPath
))
{
if
(
StringUtils
.
isNotBlank
(
thumbPath
))
{
fileInfo
.
setThumbPath
(
thumbPath
);
fileInfo
.
setThumbPath
(
thumbPath
);
fileInfo
.
setThumbUrl
(
this
.
getFileUrl
(
thumbPath
));
fileInfo
.
setThumbUrl
(
this
.
getFileUrl
(
thumbPath
,
null
,
parameter
));
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment