Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
梁志锋
9 years ago
Commit
ed13ab29f6c36a7f44ecbb3df58b3c7d519a2e46
1 parent
fec81d4e
修改WebPlugin/Image
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
library/WebPlugin/Images.php
library/WebPlugin/Images.php
View file @
ed13ab2
...
...
@@ -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,7 @@ class Images
$images
[
$files
[
'name'
]]
=
$files
[
'tmp_name'
];
}
return
self
::
uploadStreamImage
(
$images
);
return
self
::
uploadStreamImage
(
$images
,
$path
);
}
/**
...
...
@@ -164,7 +165,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 +193,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 +215,8 @@ class Images
{
$imgRelUrl
=
current
(
$result
[
'data'
][
'imagesList'
]);
$imgList
[
'imgList'
][]
=
array
(
'imgUrl'
=>
self
::
getSourceUrl
(
$imgRelUrl
,
'suggest'
)
.
$imgExtra
,
//'imgUrl' => self::getSourceUrl($imgRelUrl, 'suggest') . $imgExtra,
'imgUrl'
=>
self
::
getSourceUrl
(
$imgRelUrl
,
$path
)
.
$imgExtra
,
'imgRelUrl'
=>
$imgRelUrl
);
}
...
...
@@ -221,7 +225,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
;
}
...
...
Please
register
or
login
to post a comment