'in_reply_to_status_id' => 0,
'lat' => 0,
'long' => 0,
- 'media_ids' => [],
+ 'media_ids' => '',
'source' => '',
'include_entities' => false,
], $request);
$item['object-type'] = Activity\ObjectType::NOTE;
}
- $ids = $request['media_ids'];
-
- if (!empty($_FILES['media'])) {
+ if (!empty($_REQUEST['media_ids'])) {
+ $ids = explode(',', $_REQUEST['media_ids']);
+ } elseif (!empty($_FILES['media'])) {
// upload the image if we have one
$picture = Photo::upload($uid, $_FILES['media']);
if (!empty($picture)) {
Photo::setPermissionForRessource($media[0]['resource-id'], $uid, $item['allow_cid'], $item['allow_gid'], $item['deny_cid'], $item['deny_gid']);
$ressources[] = $media[0]['resource-id'];
- $phototypes = Images::supportedTypes();
- $ext = $phototypes[$media[0]['type']];
+ $phototypes = Images::supportedTypes();
+ $ext = $phototypes[$media[0]['type']];
- $attachment = ['type' => Post\Media::IMAGE, 'mimetype' => $media[0]['type'],
+ $attachment = [
+ 'type' => Post\Media::IMAGE,
+ 'mimetype' => $media[0]['type'],
'url' => DI::baseUrl() . '/photo/' . $media[0]['resource-id'] . '-' . $media[0]['scale'] . '.' . $ext,
'size' => $media[0]['datasize'],
'name' => $media[0]['filename'] ?: $media[0]['resource-id'],
'description' => $media[0]['desc'] ?? '',
'width' => $media[0]['width'],
- 'height' => $media[0]['height']];
+ 'height' => $media[0]['height']
+ ];
if (count($media) > 1) {
$attachment['preview'] = DI::baseUrl() . '/photo/' . $media[1]['resource-id'] . '-' . $media[1]['scale'] . '.' . $ext;
// output the post that we just posted.
$status_info = DI::twitterStatus()->createFromUriId($item['uri-id'], $uid, $request['include_entities'])->toArray();
DI::apiResponse()->exit('status', ['status' => $status_info], $this->parameters['extension'] ?? null, Contact::getPublicIdByUserId($uid));
+ return;
}
}
DI::mstdnError()->InternalError();