|
@@ -106,9 +106,8 @@ class Images |
|
@@ -106,9 +106,8 @@ class Images |
106
|
/**
|
106
|
/**
|
107
|
* 图片上传
|
107
|
* 图片上传
|
108
|
* @param string $name 文件表单name, 即用于$_FILES[$name]
|
108
|
* @param string $name 文件表单name, 即用于$_FILES[$name]
|
109
|
- * @param string $path
|
|
|
110
|
*/
|
109
|
*/
|
111
|
- public static function saveImage($name, $path = 'suggest')
|
110
|
+ public static function saveImage($name)
|
112
|
{
|
111
|
{
|
113
|
if (empty($_FILES[$name])) {
|
112
|
if (empty($_FILES[$name])) {
|
114
|
return array();
|
113
|
return array();
|
|
@@ -125,7 +124,7 @@ class Images |
|
@@ -125,7 +124,7 @@ class Images |
125
|
$images[$files['name']] = $files['tmp_name'];
|
124
|
$images[$files['name']] = $files['tmp_name'];
|
126
|
}
|
125
|
}
|
127
|
|
126
|
|
128
|
- return self::uploadStreamImage($images, $path);
|
127
|
+ return self::uploadStreamImage($images);
|
129
|
}
|
128
|
}
|
130
|
|
129
|
|
131
|
/**
|
130
|
/**
|
|
@@ -133,10 +132,9 @@ class Images |
|
@@ -133,10 +132,9 @@ class Images |
133
|
*
|
132
|
*
|
134
|
* @param string | array(filename => absolute file path) $file
|
133
|
* @param string | array(filename => absolute file path) $file
|
135
|
* url:http://upload.static.yohobuy.com?project=sns&fileData=xxx
|
134
|
* url:http://upload.static.yohobuy.com?project=sns&fileData=xxx
|
136
|
- * @param string $path
|
|
|
137
|
* @return mixed
|
135
|
* @return mixed
|
138
|
*/
|
136
|
*/
|
139
|
- public static function uploadStreamImage($file, $path = 'suggest')
|
137
|
+ public static function uploadStreamImage($file)
|
140
|
{
|
138
|
{
|
141
|
$end = "\r\n";
|
139
|
$end = "\r\n";
|
142
|
$twoHyphens = "--";
|
140
|
$twoHyphens = "--";
|
|
@@ -160,7 +158,7 @@ class Images |
|
@@ -160,7 +158,7 @@ class Images |
160
|
$stream .= $twoHyphens . $boundary . $end;
|
158
|
$stream .= $twoHyphens . $boundary . $end;
|
161
|
$stream .="Content-Disposition: form-data; " . "name=\"project\"" . $end;
|
159
|
$stream .="Content-Disposition: form-data; " . "name=\"project\"" . $end;
|
162
|
$stream .= $end;
|
160
|
$stream .= $end;
|
163
|
- $stream .= $path; //project sns
|
161
|
+ $stream .= 'suggest'; //project sns
|
164
|
$stream .= $end;
|
162
|
$stream .= $end;
|
165
|
$stream .= $twoHyphens . $boundary . $twoHyphens . $end;
|
163
|
$stream .= $twoHyphens . $boundary . $twoHyphens . $end;
|
166
|
$opts = array(
|
164
|
$opts = array(
|
|
@@ -179,14 +177,14 @@ class Images |
|
@@ -179,14 +177,14 @@ class Images |
179
|
if (count($file) == 1 || !is_array($file)) {
|
177
|
if (count($file) == 1 || !is_array($file)) {
|
180
|
$imgRelUrl = current($result['data']['imagesList']);
|
178
|
$imgRelUrl = current($result['data']['imagesList']);
|
181
|
$imgList['imgList'][] = array(
|
179
|
$imgList['imgList'][] = array(
|
182
|
- 'imgUrl' => self::getSourceUrl($imgRelUrl, $path) . $imgExtra,
|
180
|
+ 'imgUrl' => self::getSourceUrl($imgRelUrl, 'suggest') . $imgExtra,
|
183
|
'imgRelUrl' => $imgRelUrl
|
181
|
'imgRelUrl' => $imgRelUrl
|
184
|
);
|
182
|
);
|
185
|
} else {
|
183
|
} else {
|
186
|
$img = array();
|
184
|
$img = array();
|
187
|
foreach ($result['data']['imagesList'] as $val) {
|
185
|
foreach ($result['data']['imagesList'] as $val) {
|
188
|
$img = array();
|
186
|
$img = array();
|
189
|
- $img['imgUrl'] = self::getSourceUrl($val, $path) . $imgExtra;
|
187
|
+ $img['imgUrl'] = self::getSourceUrl($val, 'suggest') . $imgExtra;
|
190
|
$img['imgRelUrl'] = $val;
|
188
|
$img['imgRelUrl'] = $val;
|
191
|
$imgList['imgList'][] = $img;
|
189
|
$imgList['imgList'][] = $img;
|
192
|
}
|
190
|
}
|