mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-22 01:13:39 +00:00
Array instead of a string
This commit is contained in:
parent
e214c21025
commit
f3804ee7dd
1 changed files with 4 additions and 5 deletions
|
@ -639,10 +639,9 @@ function twitter_post_hook(App $a, array &$b)
|
||||||
|
|
||||||
if (!empty($msgarr['images'])) {
|
if (!empty($msgarr['images'])) {
|
||||||
try {
|
try {
|
||||||
$post['media_ids'] = '';
|
$media_ids = [];
|
||||||
$counter = 0;
|
|
||||||
foreach ($msgarr['images'] as $image) {
|
foreach ($msgarr['images'] as $image) {
|
||||||
if (++$counter > 4) {
|
if (count($media_ids) == 4) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,7 +655,7 @@ function twitter_post_hook(App $a, array &$b)
|
||||||
unlink($tempfile);
|
unlink($tempfile);
|
||||||
|
|
||||||
if (isset($media->media_id_string)) {
|
if (isset($media->media_id_string)) {
|
||||||
$post['media_ids'] .= $media->media_id_string . ',';
|
$media_ids[] = $media->media_id_string;
|
||||||
|
|
||||||
if (!empty($image['description'])) {
|
if (!empty($image['description'])) {
|
||||||
$data = ['media_id' => $media->media_id_string,
|
$data = ['media_id' => $media->media_id_string,
|
||||||
|
@ -668,7 +667,7 @@ function twitter_post_hook(App $a, array &$b)
|
||||||
throw new Exception('Failed upload of ' . $image['url']);
|
throw new Exception('Failed upload of ' . $image['url']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$post['media_ids'] = rtrim($post['media_ids'], ',');
|
$post['media_ids'] = implode(',', $media_ids);
|
||||||
if (empty($post['media_ids'])) {
|
if (empty($post['media_ids'])) {
|
||||||
unset($post['media_ids']);
|
unset($post['media_ids']);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue