...
|
...
|
@@ -131,7 +131,8 @@ class Images |
|
|
* 图片上传
|
|
|
* @param string $name 文件表单name, 即用于$_FILES[$name]
|
|
|
*/
|
|
|
public static function saveImage($name)
|
|
|
//public static function saveImage($name)
|
|
|
public static function saveImage($name, $path = 'suggest')
|
|
|
{
|
|
|
if (empty($_FILES[$name]))
|
|
|
{
|
...
|
...
|
@@ -154,7 +155,8 @@ class Images |
|
|
$images[$files['name']] = $files['tmp_name'];
|
|
|
}
|
|
|
|
|
|
return self::uploadStreamImage($images);
|
|
|
//return self::uploadStreamImage($images);
|
|
|
return self::uploadStreamImage($images, $path);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -164,7 +166,8 @@ class Images |
|
|
* url:http://upload.static.yohobuy.com?project=sns&fileData=xxx
|
|
|
* @return mixed
|
|
|
*/
|
|
|
public static function uploadStreamImage($file)
|
|
|
//public static function uploadStreamImage($file)
|
|
|
public static function uploadStreamImage($file, $path = 'suggest')
|
|
|
{
|
|
|
$end ="\r\n";
|
|
|
$twoHyphens ="--";
|
...
|
...
|
@@ -191,7 +194,8 @@ class Images |
|
|
$stream .= $twoHyphens.$boundary.$end;
|
|
|
$stream .="Content-Disposition: form-data; "."name=\"project\"".$end;
|
|
|
$stream .= $end;
|
|
|
$stream .= "suggest";//project sns
|
|
|
//$stream .= "suggest";//project sns
|
|
|
$stream .= $path; //project sns
|
|
|
$stream .= $end;
|
|
|
$stream .= $twoHyphens .$boundary .$twoHyphens .$end;
|
|
|
$opts = array(
|
...
|
...
|
@@ -212,7 +216,8 @@ class Images |
|
|
{
|
|
|
$imgRelUrl = current($result['data']['imagesList']);
|
|
|
$imgList['imgList'][] = array(
|
|
|
'imgUrl' => self::getSourceUrl($imgRelUrl, 'suggest') . $imgExtra,
|
|
|
//'imgUrl' => self::getSourceUrl($imgRelUrl, 'suggest') . $imgExtra,
|
|
|
$img['imgUrl'] = self::getSourceUrl($imgRelUrl, $path) . $imgExtra,
|
|
|
'imgRelUrl' => $imgRelUrl
|
|
|
);
|
|
|
}
|
...
|
...
|
@@ -221,7 +226,8 @@ class Images |
|
|
$img = array();
|
|
|
foreach ($result['data']['imagesList'] as $val) {
|
|
|
$img = array();
|
|
|
$img['imgUrl'] = self::getSourceUrl($val, 'suggest') . $imgExtra;
|
|
|
//$img['imgUrl'] = self::getSourceUrl($val, 'suggest') . $imgExtra;
|
|
|
$img['imgUrl'] = self::getSourceUrl($val, $path) . $imgExtra;
|
|
|
$img['imgRelUrl'] = $val;
|
|
|
$imgList['imgList'][] = $img;
|
|
|
}
|
...
|
...
|
|