取消图片压缩

This commit is contained in:
2025-09-04 20:34:27 +08:00
parent 8e11385a7f
commit d75bff5b9c

View File

@@ -26,7 +26,7 @@
</view> </view>
</view> </view>
<view class="image-tip"> <view class="image-tip">
<text>最多选择3张图片支持自动压缩</text> <text>最多选择3张图片</text>
</view> </view>
</view> </view>
</view> </view>
@@ -114,8 +114,8 @@
uni.chooseImage({ uni.chooseImage({
count: 3 - this.img.length, // 最多选择剩余可选数量 count: 3 - this.img.length, // 最多选择剩余可选数量
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 sizeType: ['compressed'], // 使用压缩图
sourceType: ['camera', 'album'], // 可以指定来源是相册还是相机,默认二者都有 sourceType: ['camera'], // 只能拍照
success: (res) => { success: (res) => {
// 处理选择的图片 // 处理选择的图片
res.tempFilePaths.forEach((filePath, index) => { res.tempFilePaths.forEach((filePath, index) => {
@@ -171,8 +171,7 @@
// 添加水印 // 添加水印
let processedFile = await addWatermarkToImage(file, watermarkText); let processedFile = await addWatermarkToImage(file, watermarkText);
// 自动压缩图片(所有图片都进行压缩优化) // 不进行额外压缩,使用系统自带压缩
processedFile = await this.compressImage(processedFile);
// 上传处理后的文件 // 上传处理后的文件
const fileUrl = await this.uploadFile(processedFile); const fileUrl = await this.uploadFile(processedFile);
@@ -256,8 +255,7 @@
// 添加水印 // 添加水印
let processedFile = await addWatermarkToImage(file.file, watermarkText); let processedFile = await addWatermarkToImage(file.file, watermarkText);
// 使用新的压缩方法 // 不进行额外压缩,使用系统自带压缩
processedFile = await this.compressImage(processedFile);
// 上传处理后的文件 // 上传处理后的文件
const fileUrl = await this.uploadFile(processedFile); const fileUrl = await this.uploadFile(processedFile);