-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathimageOps.js
52 lines (42 loc) · 891 Bytes
/
imageOps.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
* Created by buhe on 16/4/12.
*/
import util from './auth';
import rpc from './rpc';
import conf from './conf';
class ImageView {
constructor(mode, width, height, quality, format) {
this.mode = mode || 1;
this.width = width || 0;
this.height = height || 0;
this.quality = quality || 0;
this.format = format || null;
}
makeRequest(url) {
url += '?imageView2/' + this.mode;
if (this.width > 0) {
url += '/w/' + this.width;
}
if (this.height > 0) {
url += '/h/' + this.height;
}
if (this.quality > 0) {
url += '/q/' + this.quality;
}
if (this.format) {
url += '/format/' + this.format;
}
return url;
}
}
class ImageInfo {
makeRequest(url) {
return url + '?imageInfo'
}
}
class Exif {
makeRequest(url) {
return url + '?exif'
}
}
export default {ImageView,ImageInfo,Exif}