git.cweiske.de
/
shpub.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
41dee20
)
support image urls
author
Christian Weiske
<cweiske@cweiske.de>
Thu, 8 Sep 2016 19:35:52 +0000
(21:35 +0200)
committer
Christian Weiske
<cweiske@cweiske.de>
Thu, 8 Sep 2016 19:35:52 +0000
(21:35 +0200)
src/shpub/Command/Note.php
patch
|
blob
|
history
diff --git
a/src/shpub/Command/Note.php
b/src/shpub/Command/Note.php
index d7a709ed164c51be8306e2d80ef8dce8d7c36a2a..4a09b5afce5cd70a084267f9681384666da664bd 100644
(file)
--- a/
src/shpub/Command/Note.php
+++ b/
src/shpub/Command/Note.php
@@
-49,13
+49,30
@@
class Command_Note
'photo' => [],
'video' => [],
];
'photo' => [],
'video' => [],
];
+ $urls = [];
foreach ($files as $filePath) {
foreach ($files as $filePath) {
- if (!file_exists($filePath)) {
+ if (file_exists($filePath)) {
+ $type = 'photo';
+ $fileList[$type][] = $filePath;
+ } else if (strpos($filePath, '://') !== false) {
+ //url
+ $urls[] = $filePath;
+ } else {
Log::err('File does not exist: ' . $filePath);
exit(20);
}
Log::err('File does not exist: ' . $filePath);
exit(20);
}
- $type = 'photo';
- $fileList[$type][] = $filePath;
+ }
+ if (count($urls)) {
+ if (count($urls) == 1) {
+ $req->req->addPostParameter('photo', reset($urls));
+ } else {
+ $n = 0;
+ foreach ($urls as $url) {
+ $req->req->addPostParameter(
+ 'photo[' . $n++ . ']', reset($urls)
+ );
+ }
+ }
}
foreach ($fileList as $type => $filePaths) {
if (count($filePaths) == 1) {
}
foreach ($fileList as $type => $filePaths) {
if (count($filePaths) == 1) {