fop.php
1.88 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
require_once("auth_digest.php");
// --------------------------------------------------------------------------------
// class Qiniu_ImageView
class Qiniu_ImageView
{
public $Mode;
public $Width;
public $Height;
public $Quality;
public $Format;
public function MakeRequest($url)
{
$ops = array();
if (!empty($this->Mode)) {
$ops = array($this->Mode);
}
if (!empty($this->Width)) {
$ops[] = 'w/' . $this->Width;
}
if (!empty($this->Height)) {
$ops[] = 'h/' . $this->Height;
}
if (!empty($this->Quality)) {
$ops[] = 'q/' . $this->Quality;
}
if (!empty($this->Format)) {
$ops[] = 'format/' . $this->Format;
}
if (empty($ops)) {
return $url;
}
return $url . "?imageView/" . implode('/', $ops);
}
public function MakeTemplateRequest($url)
{
$ops = array();
// if (!empty($this->Mode)) {
// $ops = array($this->Mode);
// }
$ops[] = '{mode}';
$ops[] = 'w/{width}';
$ops[] = 'h/{height}';
if (!empty($this->Quality)) {
$ops[] = 'q/' . $this->Quality;
}
if (!empty($this->Format)) {
$ops[] = 'format/' . $this->Format;
}
if (empty($ops)) {
return $url;
}
return $url . "?imageView/" . implode('/', $ops);
}
}
// --------------------------------------------------------------------------------
// class Qiniu_Exif
class Qiniu_Exif
{
public function MakeRequest($url)
{
return $url . "?exif";
}
}
// --------------------------------------------------------------------------------
// class Qiniu_ImageInfo
class Qiniu_ImageInfo
{
public function MakeRequest($url)
{
return $url . "?imageInfo";
}
}