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 8f2460f5
authored
May 26, 2026
by
章家宝
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:获取图片的时候加上格式化图片的能力
1 parent
62052b67
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 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 @
8f2460f
package
com
.
glsx
.
usedcar
.
storage
;
import
com.aliyun.oss.HttpMethod
;
import
com.aliyun.oss.OSS
;
import
com.aliyun.oss.model.*
;
import
jakarta.annotation.Nullable
;
import
net.coobird.thumbnailator.Thumbnails
;
import
net.coobird.thumbnailator.geometry.Positions
;
import
org.apache.commons.lang3.RandomStringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.summerframework.storage.FileStorageException
;
import
org.summerframework.storage.StorageService
;
import
org.summerframework.storage.domain.FileInfo
;
import
org.summerframework.storage.platform.AbstractStorageService
;
...
...
@@ -240,8 +239,14 @@ public class AliyunOssService extends AbstractStorageService {
// 计算过期时间
Date
expiration
=
new
Date
(
System
.
currentTimeMillis
()
+
unit
.
toMillis
(
time
));
GeneratePresignedUrlRequest
request
=
new
GeneratePresignedUrlRequest
(
bucketName
,
savePath
);
request
.
setExpiration
(
expiration
);
request
.
setMethod
(
HttpMethod
.
GET
);
if
(
isImageFile
(
fileName
))
{
request
.
setProcess
(
"image/format,jpg"
);
}
// 生成预签名URL
URL
url
=
ossClient
.
generatePresignedUrl
(
bucketName
,
savePath
,
expiration
);
URL
url
=
ossClient
.
generatePresignedUrl
(
request
);
String
presignedUrl
=
url
.
toString
();
...
...
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