Showing
1 changed file
with
11 additions
and
6 deletions
@@ -131,7 +131,8 @@ class Images | @@ -131,7 +131,8 @@ class Images | ||
131 | * 图片上传 | 131 | * 图片上传 |
132 | * @param string $name 文件表单name, 即用于$_FILES[$name] | 132 | * @param string $name 文件表单name, 即用于$_FILES[$name] |
133 | */ | 133 | */ |
134 | - public static function saveImage($name) | 134 | + //public static function saveImage($name) |
135 | + public static function saveImage($name, $path = 'suggest') | ||
135 | { | 136 | { |
136 | if (empty($_FILES[$name])) | 137 | if (empty($_FILES[$name])) |
137 | { | 138 | { |
@@ -154,7 +155,7 @@ class Images | @@ -154,7 +155,7 @@ class Images | ||
154 | $images[$files['name']] = $files['tmp_name']; | 155 | $images[$files['name']] = $files['tmp_name']; |
155 | } | 156 | } |
156 | 157 | ||
157 | - return self::uploadStreamImage($images); | 158 | + return self::uploadStreamImage($images, $path); |
158 | } | 159 | } |
159 | 160 | ||
160 | /** | 161 | /** |
@@ -164,7 +165,8 @@ class Images | @@ -164,7 +165,8 @@ class Images | ||
164 | * url:http://upload.static.yohobuy.com?project=sns&fileData=xxx | 165 | * url:http://upload.static.yohobuy.com?project=sns&fileData=xxx |
165 | * @return mixed | 166 | * @return mixed |
166 | */ | 167 | */ |
167 | - public static function uploadStreamImage($file) | 168 | + //public static function uploadStreamImage($file) |
169 | + public static function uploadStreamImage($file, $path = 'suggest') | ||
168 | { | 170 | { |
169 | $end ="\r\n"; | 171 | $end ="\r\n"; |
170 | $twoHyphens ="--"; | 172 | $twoHyphens ="--"; |
@@ -191,7 +193,8 @@ class Images | @@ -191,7 +193,8 @@ class Images | ||
191 | $stream .= $twoHyphens.$boundary.$end; | 193 | $stream .= $twoHyphens.$boundary.$end; |
192 | $stream .="Content-Disposition: form-data; "."name=\"project\"".$end; | 194 | $stream .="Content-Disposition: form-data; "."name=\"project\"".$end; |
193 | $stream .= $end; | 195 | $stream .= $end; |
194 | - $stream .= "suggest";//project sns | 196 | + //$stream .= "suggest";//project sns |
197 | + $stream .= $path; //project sns | ||
195 | $stream .= $end; | 198 | $stream .= $end; |
196 | $stream .= $twoHyphens .$boundary .$twoHyphens .$end; | 199 | $stream .= $twoHyphens .$boundary .$twoHyphens .$end; |
197 | $opts = array( | 200 | $opts = array( |
@@ -212,7 +215,8 @@ class Images | @@ -212,7 +215,8 @@ class Images | ||
212 | { | 215 | { |
213 | $imgRelUrl = current($result['data']['imagesList']); | 216 | $imgRelUrl = current($result['data']['imagesList']); |
214 | $imgList['imgList'][] = array( | 217 | $imgList['imgList'][] = array( |
215 | - 'imgUrl' => self::getSourceUrl($imgRelUrl, 'suggest') . $imgExtra, | 218 | + //'imgUrl' => self::getSourceUrl($imgRelUrl, 'suggest') . $imgExtra, |
219 | + 'imgUrl' => self::getSourceUrl($imgRelUrl, $path) . $imgExtra, | ||
216 | 'imgRelUrl' => $imgRelUrl | 220 | 'imgRelUrl' => $imgRelUrl |
217 | ); | 221 | ); |
218 | } | 222 | } |
@@ -221,7 +225,8 @@ class Images | @@ -221,7 +225,8 @@ class Images | ||
221 | $img = array(); | 225 | $img = array(); |
222 | foreach ($result['data']['imagesList'] as $val) { | 226 | foreach ($result['data']['imagesList'] as $val) { |
223 | $img = array(); | 227 | $img = array(); |
224 | - $img['imgUrl'] = self::getSourceUrl($val, 'suggest') . $imgExtra; | 228 | + //$img['imgUrl'] = self::getSourceUrl($val, 'suggest') . $imgExtra; |
229 | + $img['imgUrl'] = self::getSourceUrl($val, $path) . $imgExtra; | ||
225 | $img['imgRelUrl'] = $val; | 230 | $img['imgRelUrl'] = $val; |
226 | $imgList['imgList'][] = $img; | 231 | $imgList['imgList'][] = $img; |
227 | } | 232 | } |
-
Please register or login to post a comment