@netang/quasar 0.2.20 → 0.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/uploader/index.vue +1 -0
- package/package.json +1 -1
- package/utils/getImage.js +73 -73
package/package.json
CHANGED
package/utils/getImage.js
CHANGED
|
@@ -141,47 +141,47 @@ export default function getImage(src, options) {
|
|
|
141
141
|
)
|
|
142
142
|
)
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
//
|
|
184
|
-
|
|
144
|
+
const {
|
|
145
|
+
compress,
|
|
146
|
+
mode,
|
|
147
|
+
w,
|
|
148
|
+
h,
|
|
149
|
+
q,
|
|
150
|
+
interlace,
|
|
151
|
+
ignoreError,
|
|
152
|
+
format,
|
|
153
|
+
} = Object.assign({
|
|
154
|
+
// 是否压缩
|
|
155
|
+
compress: true,
|
|
156
|
+
// 模式
|
|
157
|
+
mode: '2',
|
|
158
|
+
// 宽
|
|
159
|
+
w: 0,
|
|
160
|
+
// 高
|
|
161
|
+
h: 0,
|
|
162
|
+
// 质量
|
|
163
|
+
q: 75,
|
|
164
|
+
// 是否支持渐进显示
|
|
165
|
+
interlace: false,
|
|
166
|
+
// 是否忽略错误
|
|
167
|
+
// 主要针对图片兼容性的问题导致无法处理, 取值为 1 时, 则处理失败时返回原图
|
|
168
|
+
// 不设置此参数, 默认处理失败时返回错误信息
|
|
169
|
+
ignoreError: false,
|
|
170
|
+
// 格式
|
|
171
|
+
format: 'webp',
|
|
172
|
+
}, options)
|
|
173
|
+
|
|
174
|
+
// 如果压缩
|
|
175
|
+
if (compress) {
|
|
176
|
+
|
|
177
|
+
// 判断图片上传方式
|
|
178
|
+
switch (type) {
|
|
179
|
+
|
|
180
|
+
// 七牛云
|
|
181
|
+
// 文档: https://developer.qiniu.com/dora/1279/basic-processing-images-imageview2
|
|
182
|
+
case 'qiniu':
|
|
183
|
+
// minio
|
|
184
|
+
case 'minio':
|
|
185
185
|
|
|
186
186
|
// 裁剪图片方式
|
|
187
187
|
src += `?imageView2/${mode}`
|
|
@@ -215,48 +215,48 @@ export default function getImage(src, options) {
|
|
|
215
215
|
if (format) {
|
|
216
216
|
src += '/format/' + format
|
|
217
217
|
}
|
|
218
|
-
|
|
219
|
-
break
|
|
218
|
+
break
|
|
220
219
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
220
|
+
// 【oss】
|
|
221
|
+
// -------------------------------------------------------------------------------------------------
|
|
222
|
+
// 文档: https://help.aliyun.com/document_detail/44686.html
|
|
223
|
+
case 'oss':
|
|
225
224
|
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
// 裁剪图片方式
|
|
226
|
+
src += `?x-oss-process=image`
|
|
228
227
|
|
|
229
|
-
|
|
230
|
-
|
|
228
|
+
// 缩放
|
|
229
|
+
if (w || h) {
|
|
231
230
|
|
|
232
|
-
|
|
231
|
+
src += '/resize'
|
|
233
232
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
233
|
+
// 宽
|
|
234
|
+
if (w) {
|
|
235
|
+
src += ',w_' + w
|
|
236
|
+
}
|
|
238
237
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
238
|
+
// 高
|
|
239
|
+
if (h) {
|
|
240
|
+
src += ',h_' + h
|
|
241
|
+
}
|
|
242
242
|
}
|
|
243
|
-
}
|
|
244
243
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
244
|
+
// 质量
|
|
245
|
+
if (q) {
|
|
246
|
+
src += '/quality,q_' + q
|
|
247
|
+
}
|
|
249
248
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
249
|
+
// 渐进显示
|
|
250
|
+
if (interlace) {
|
|
251
|
+
src += '/interlace,1'
|
|
252
|
+
}
|
|
254
253
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
254
|
+
// 格式化
|
|
255
|
+
if (format) {
|
|
256
|
+
src += '/format,' + format
|
|
257
|
+
}
|
|
258
|
+
break
|
|
259
|
+
}
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
// 【调试模式】
|