Merge pull request #12065 from Quix0r/cleanup/renaming-more-logging
Cleanups: renaming variables and more logging
This commit is contained in:
commit
3456ae7809
|
@ -24,11 +24,11 @@ use Friendica\App;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
|
||||||
require_once("mod/notes.php");
|
require_once 'mod/notes.php';
|
||||||
|
|
||||||
function update_notes_content(App $a) {
|
function update_notes_content(App $a)
|
||||||
|
{
|
||||||
$profile_uid = intval($_GET["p"]);
|
$profile_uid = intval($_GET['p']);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
|
use Friendica\Core\Logger;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
@ -27,28 +28,30 @@ use Friendica\Model\Attach;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
function wall_attach_post(App $a) {
|
function wall_attach_post(App $a)
|
||||||
|
{
|
||||||
$r_json = (!empty($_GET['response']) && $_GET['response']=='json');
|
$isJson = (!empty($_GET['response']) && $_GET['response'] == 'json');
|
||||||
|
|
||||||
if (DI::args()->getArgc() > 1) {
|
if (DI::args()->getArgc() > 1) {
|
||||||
$nick = DI::args()->getArgv()[1];
|
$nick = DI::args()->getArgv()[1];
|
||||||
$owner = User::getOwnerDataByNick($nick);
|
$owner = User::getOwnerDataByNick($nick);
|
||||||
if (!DBA::isResult($owner)) {
|
if (!DBA::isResult($owner)) {
|
||||||
if ($r_json) {
|
Logger::warning('owner is not a valid record:', ['owner' => $owner, 'nick' => $nick]);
|
||||||
|
if ($isJson) {
|
||||||
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($r_json) {
|
Logger::warning('Argument count is zero or one (invalid)');
|
||||||
|
if ($isJson) {
|
||||||
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$can_post = false;
|
$can_post = false;
|
||||||
|
|
||||||
$page_owner_uid = $owner['uid'];
|
$page_owner_uid = $owner['uid'];
|
||||||
$page_owner_cid = $owner['id'];
|
$page_owner_cid = $owner['id'];
|
||||||
|
@ -58,11 +61,12 @@ function wall_attach_post(App $a) {
|
||||||
$can_post = true;
|
$can_post = true;
|
||||||
} elseif ($community_page && !empty(DI::userSession()->getRemoteContactID($page_owner_uid))) {
|
} elseif ($community_page && !empty(DI::userSession()->getRemoteContactID($page_owner_uid))) {
|
||||||
$contact_id = DI::userSession()->getRemoteContactID($page_owner_uid);
|
$contact_id = DI::userSession()->getRemoteContactID($page_owner_uid);
|
||||||
$can_post = DBA::exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
|
$can_post = DBA::exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$can_post) {
|
if (!$can_post) {
|
||||||
if ($r_json) {
|
Logger::warning('User does not have required permissions', ['contact_id' => $contact_id, 'page_owner_uid' => $page_owner_uid]);
|
||||||
|
if ($isJson) {
|
||||||
System::jsonExit(['error' => DI::l10n()->t('Permission denied.')]);
|
System::jsonExit(['error' => DI::l10n()->t('Permission denied.')]);
|
||||||
}
|
}
|
||||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||||
|
@ -70,28 +74,28 @@ function wall_attach_post(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($_FILES['userfile'])) {
|
if (empty($_FILES['userfile'])) {
|
||||||
if ($r_json) {
|
Logger::warning('No file uploaded (empty userfile)');
|
||||||
|
if ($isJson) {
|
||||||
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
||||||
}
|
}
|
||||||
System::exit();
|
System::exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$src = $_FILES['userfile']['tmp_name'];
|
$tempFileName = $_FILES['userfile']['tmp_name'];
|
||||||
$filename = basename($_FILES['userfile']['name']);
|
$fileName = basename($_FILES['userfile']['name']);
|
||||||
$filesize = intval($_FILES['userfile']['size']);
|
$fileSize = intval($_FILES['userfile']['size']);
|
||||||
|
$maxFileSize = DI::config()->get('system', 'maxfilesize');
|
||||||
|
|
||||||
$maxfilesize = DI::config()->get('system','maxfilesize');
|
/*
|
||||||
|
* Found html code written in text field of form, when trying to upload a
|
||||||
/* Found html code written in text field of form,
|
* file with filesize greater than upload_max_filesize. Cause is unknown.
|
||||||
* when trying to upload a file with filesize
|
|
||||||
* greater than upload_max_filesize. Cause is unknown.
|
|
||||||
* Then Filesize gets <= 0.
|
* Then Filesize gets <= 0.
|
||||||
*/
|
*/
|
||||||
|
if ($fileSize <= 0) {
|
||||||
if ($filesize <= 0) {
|
$msg = DI::l10n()->t('Sorry, maybe your upload is bigger than the PHP configuration allows') . '<br />' . DI::l10n()->t('Or - did you try to upload an empty file?');
|
||||||
$msg = DI::l10n()->t('Sorry, maybe your upload is bigger than the PHP configuration allows') . '<br />' . (DI::l10n()->t('Or - did you try to upload an empty file?'));
|
Logger::warning($msg, ['fileSize' => $fileSize]);
|
||||||
@unlink($src);
|
@unlink($tempFileName);
|
||||||
if ($r_json) {
|
if ($isJson) {
|
||||||
System::jsonExit(['error' => $msg]);
|
System::jsonExit(['error' => $msg]);
|
||||||
} else {
|
} else {
|
||||||
DI::sysmsg()->addNotice($msg);
|
DI::sysmsg()->addNotice($msg);
|
||||||
|
@ -99,10 +103,11 @@ function wall_attach_post(App $a) {
|
||||||
System::exit();
|
System::exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($maxfilesize && $filesize > $maxfilesize) {
|
if ($maxFileSize && $fileSize > $maxFileSize) {
|
||||||
$msg = DI::l10n()->t('File exceeds size limit of %s', Strings::formatBytes($maxfilesize));
|
$msg = DI::l10n()->t('File exceeds size limit of %s', Strings::formatBytes($maxFileSize));
|
||||||
@unlink($src);
|
Logger::warning($msg, ['fileSize' => $fileSize]);
|
||||||
if ($r_json) {
|
@unlink($tempFileName);
|
||||||
|
if ($isJson) {
|
||||||
System::jsonExit(['error' => $msg]);
|
System::jsonExit(['error' => $msg]);
|
||||||
} else {
|
} else {
|
||||||
echo $msg . '<br />';
|
echo $msg . '<br />';
|
||||||
|
@ -110,13 +115,14 @@ function wall_attach_post(App $a) {
|
||||||
System::exit();
|
System::exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$newid = Attach::storeFile($src, $page_owner_uid, $filename, '<' . $page_owner_cid . '>');
|
$newid = Attach::storeFile($tempFileName, $page_owner_uid, $fileName, '<' . $page_owner_cid . '>');
|
||||||
|
|
||||||
@unlink($src);
|
@unlink($tempFileName);
|
||||||
|
|
||||||
if ($newid === false) {
|
if ($newid === false) {
|
||||||
$msg = DI::l10n()->t('File upload failed.');
|
$msg = DI::l10n()->t('File upload failed.');
|
||||||
if ($r_json) {
|
Logger::warning($msg);
|
||||||
|
if ($isJson) {
|
||||||
System::jsonExit(['error' => $msg]);
|
System::jsonExit(['error' => $msg]);
|
||||||
} else {
|
} else {
|
||||||
echo $msg . '<br />';
|
echo $msg . '<br />';
|
||||||
|
@ -124,7 +130,7 @@ function wall_attach_post(App $a) {
|
||||||
System::exit();
|
System::exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($r_json) {
|
if ($isJson) {
|
||||||
System::jsonExit(['ok' => true, 'id' => $newid]);
|
System::jsonExit(['ok' => true, 'id' => $newid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,17 +39,18 @@ use Friendica\Util\Strings;
|
||||||
|
|
||||||
function wall_upload_post(App $a, $desktopmode = true)
|
function wall_upload_post(App $a, $desktopmode = true)
|
||||||
{
|
{
|
||||||
Logger::info("wall upload: starting new upload");
|
Logger::info('wall upload: starting new upload');
|
||||||
|
|
||||||
$r_json = (!empty($_GET['response']) && $_GET['response'] == 'json');
|
$isJson = (!empty($_GET['response']) && $_GET['response'] == 'json');
|
||||||
$album = trim($_GET['album'] ?? '');
|
$album = trim($_GET['album'] ?? '');
|
||||||
|
|
||||||
if (DI::args()->getArgc() > 1) {
|
if (DI::args()->getArgc() > 1) {
|
||||||
if (empty($_FILES['media'])) {
|
if (empty($_FILES['media'])) {
|
||||||
$nick = DI::args()->getArgv()[1];
|
$nick = DI::args()->getArgv()[1];
|
||||||
$user = DBA::selectFirst('owner-view', ['id', 'uid', 'nickname', 'page-flags'], ['nickname' => $nick, 'blocked' => false]);
|
$user = DBA::selectFirst('owner-view', ['id', 'uid', 'nickname', 'page-flags'], ['nickname' => $nick, 'blocked' => false]);
|
||||||
if (!DBA::isResult($user)) {
|
if (!DBA::isResult($user)) {
|
||||||
if ($r_json) {
|
Logger::warning('wall upload: user instance is not valid', ['user' => $user, 'nickname' => $nick]);
|
||||||
|
if ($isJson) {
|
||||||
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -58,7 +59,8 @@ function wall_upload_post(App $a, $desktopmode = true)
|
||||||
$user = DBA::selectFirst('owner-view', ['id', 'uid', 'nickname', 'page-flags'], ['uid' => BaseApi::getCurrentUserID(), 'blocked' => false]);
|
$user = DBA::selectFirst('owner-view', ['id', 'uid', 'nickname', 'page-flags'], ['uid' => BaseApi::getCurrentUserID(), 'blocked' => false]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($r_json) {
|
Logger:warning('Argument count is zero or one (invalid)');
|
||||||
|
if ($isJson) {
|
||||||
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -67,47 +69,50 @@ function wall_upload_post(App $a, $desktopmode = true)
|
||||||
/*
|
/*
|
||||||
* Setup permissions structures
|
* Setup permissions structures
|
||||||
*/
|
*/
|
||||||
$can_post = false;
|
$can_post = false;
|
||||||
$visitor = 0;
|
$visitor = 0;
|
||||||
|
|
||||||
$page_owner_uid = $user['uid'];
|
$page_owner_uid = $user['uid'];
|
||||||
$default_cid = $user['id'];
|
$default_cid = $user['id'];
|
||||||
$page_owner_nick = $user['nickname'];
|
$page_owner_nick = $user['nickname'];
|
||||||
$community_page = (($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY) ? true : false);
|
$community_page = ($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY);
|
||||||
|
|
||||||
if ((DI::userSession()->getLocalUserId()) && (DI::userSession()->getLocalUserId() == $page_owner_uid)) {
|
if ((DI::userSession()->getLocalUserId()) && (DI::userSession()->getLocalUserId() == $page_owner_uid)) {
|
||||||
$can_post = true;
|
$can_post = true;
|
||||||
} elseif ($community_page && !empty(DI::userSession()->getRemoteContactID($page_owner_uid))) {
|
} elseif ($community_page && !empty(DI::userSession()->getRemoteContactID($page_owner_uid))) {
|
||||||
$contact_id = DI::userSession()->getRemoteContactID($page_owner_uid);
|
$contact_id = DI::userSession()->getRemoteContactID($page_owner_uid);
|
||||||
$can_post = DBA::exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
|
$can_post = DBA::exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
|
||||||
$visitor = $contact_id;
|
$visitor = $contact_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$can_post) {
|
if (!$can_post) {
|
||||||
if ($r_json) {
|
Logger::warning('No permission to upload files', ['contact_id' => $contact_id, 'page_owner_uid' => $page_owner_uid]);
|
||||||
System::jsonExit(['error' => DI::l10n()->t('Permission denied.')]);
|
$msg = DI::l10n()->t('Permission denied.');
|
||||||
|
if ($isJson) {
|
||||||
|
System::jsonExit(['error' => $msg]);
|
||||||
}
|
}
|
||||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
DI::sysmsg()->addNotice($msg);
|
||||||
System::exit();
|
System::exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($_FILES['userfile']) && empty($_FILES['media'])) {
|
if (empty($_FILES['userfile']) && empty($_FILES['media'])) {
|
||||||
if ($r_json) {
|
Logger::warning('Empty "userfile" and "media" field');
|
||||||
|
if ($isJson) {
|
||||||
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
||||||
}
|
}
|
||||||
System::exit();
|
System::exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$src = '';
|
$src = '';
|
||||||
$filename = '';
|
$filename = '';
|
||||||
$filesize = 0;
|
$filesize = 0;
|
||||||
$filetype = '';
|
$filetype = '';
|
||||||
|
|
||||||
if (!empty($_FILES['userfile'])) {
|
if (!empty($_FILES['userfile'])) {
|
||||||
$src = $_FILES['userfile']['tmp_name'];
|
$src = $_FILES['userfile']['tmp_name'];
|
||||||
$filename = basename($_FILES['userfile']['name']);
|
$filename = basename($_FILES['userfile']['name']);
|
||||||
$filesize = intval($_FILES['userfile']['size']);
|
$filesize = intval($_FILES['userfile']['size']);
|
||||||
$filetype = $_FILES['userfile']['type'];
|
$filetype = $_FILES['userfile']['type'];
|
||||||
|
|
||||||
} elseif (!empty($_FILES['media'])) {
|
} elseif (!empty($_FILES['media'])) {
|
||||||
if (!empty($_FILES['media']['tmp_name'])) {
|
if (!empty($_FILES['media']['tmp_name'])) {
|
||||||
if (is_array($_FILES['media']['tmp_name'])) {
|
if (is_array($_FILES['media']['tmp_name'])) {
|
||||||
|
@ -142,29 +147,36 @@ function wall_upload_post(App $a, $desktopmode = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($src == "") {
|
if ($src == '') {
|
||||||
if ($r_json) {
|
Logger::warning('File source (temporary file) cannot be determined');
|
||||||
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
|
$msg = DI::l10n()->t('Invalid request.');
|
||||||
|
if ($isJson) {
|
||||||
|
System::jsonExit(['error' => $msg]);
|
||||||
}
|
}
|
||||||
DI::sysmsg()->addNotice(DI::l10n()->t('Invalid request.'));
|
DI::sysmsg()->addNotice($msg);
|
||||||
System::exit();
|
System::exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$filetype = Images::getMimeTypeBySource($src, $filename, $filetype);
|
$filetype = Images::getMimeTypeBySource($src, $filename, $filetype);
|
||||||
|
|
||||||
Logger::info("File upload src: " . $src . " - filename: " . $filename .
|
Logger::info('File upload:', [
|
||||||
" - size: " . $filesize . " - type: " . $filetype);
|
'src' => $src,
|
||||||
|
'filename' => $filename,
|
||||||
|
'filesize' => $filesize,
|
||||||
|
'filetype' => $filetype,
|
||||||
|
]);
|
||||||
|
|
||||||
$imagedata = @file_get_contents($src);
|
$imagedata = @file_get_contents($src);
|
||||||
$image = new Image($imagedata, $filetype);
|
$image = new Image($imagedata, $filetype);
|
||||||
|
|
||||||
if (!$image->isValid()) {
|
if (!$image->isValid()) {
|
||||||
$msg = DI::l10n()->t('Unable to process image.');
|
$msg = DI::l10n()->t('Unable to process image.');
|
||||||
|
Logger::warning($msg, ['imagedata[]' => gettype($imagedata), 'filetype' => $filetype]);
|
||||||
@unlink($src);
|
@unlink($src);
|
||||||
if ($r_json) {
|
if ($isJson) {
|
||||||
System::jsonExit(['error' => $msg]);
|
System::jsonExit(['error' => $msg]);
|
||||||
} else {
|
} else {
|
||||||
echo $msg . '<br />';
|
echo $msg . '<br />';
|
||||||
}
|
}
|
||||||
System::exit();
|
System::exit();
|
||||||
}
|
}
|
||||||
|
@ -176,10 +188,10 @@ function wall_upload_post(App $a, $desktopmode = true)
|
||||||
if ($max_length > 0) {
|
if ($max_length > 0) {
|
||||||
$image->scaleDown($max_length);
|
$image->scaleDown($max_length);
|
||||||
$filesize = strlen($image->asString());
|
$filesize = strlen($image->asString());
|
||||||
Logger::info("File upload: Scaling picture to new size " . $max_length);
|
Logger::info('File upload: Scaling picture to new size', ['max_length' => $max_length]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$width = $image->getWidth();
|
$width = $image->getWidth();
|
||||||
$height = $image->getHeight();
|
$height = $image->getHeight();
|
||||||
|
|
||||||
$maximagesize = DI::config()->get('system', 'maximagesize');
|
$maximagesize = DI::config()->get('system', 'maximagesize');
|
||||||
|
@ -191,15 +203,15 @@ function wall_upload_post(App $a, $desktopmode = true)
|
||||||
Logger::info('Resize', ['size' => $filesize, 'width' => $width, 'height' => $height, 'max' => $maximagesize, 'pixels' => $pixels]);
|
Logger::info('Resize', ['size' => $filesize, 'width' => $width, 'height' => $height, 'max' => $maximagesize, 'pixels' => $pixels]);
|
||||||
$image->scaleDown($pixels);
|
$image->scaleDown($pixels);
|
||||||
$filesize = strlen($image->asString());
|
$filesize = strlen($image->asString());
|
||||||
$width = $image->getWidth();
|
$width = $image->getWidth();
|
||||||
$height = $image->getHeight();
|
$height = $image->getHeight();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($filesize > $maximagesize) {
|
if ($filesize > $maximagesize) {
|
||||||
Logger::notice('Image size is too big', ['size' => $filesize, 'max' => $maximagesize]);
|
Logger::notice('Image size is too big', ['size' => $filesize, 'max' => $maximagesize]);
|
||||||
$msg = DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize));
|
$msg = DI::l10n()->t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize));
|
||||||
@unlink($src);
|
@unlink($src);
|
||||||
if ($r_json) {
|
if ($isJson) {
|
||||||
System::jsonExit(['error' => $msg]);
|
System::jsonExit(['error' => $msg]);
|
||||||
} else {
|
} else {
|
||||||
echo $msg . '<br />';
|
echo $msg . '<br />';
|
||||||
|
@ -223,7 +235,8 @@ function wall_upload_post(App $a, $desktopmode = true)
|
||||||
|
|
||||||
if (!$r) {
|
if (!$r) {
|
||||||
$msg = DI::l10n()->t('Image upload failed.');
|
$msg = DI::l10n()->t('Image upload failed.');
|
||||||
if ($r_json) {
|
Logger::warning('Photo::store() failed', ['r' => $r]);
|
||||||
|
if ($isJson) {
|
||||||
System::jsonExit(['error' => $msg]);
|
System::jsonExit(['error' => $msg]);
|
||||||
} else {
|
} else {
|
||||||
echo $msg . '<br />';
|
echo $msg . '<br />';
|
||||||
|
@ -250,32 +263,34 @@ function wall_upload_post(App $a, $desktopmode = true)
|
||||||
if (!$desktopmode) {
|
if (!$desktopmode) {
|
||||||
$photo = Photo::selectFirst(['id', 'datasize', 'width', 'height', 'type'], ['resource-id' => $resource_id], ['order' => ['width']]);
|
$photo = Photo::selectFirst(['id', 'datasize', 'width', 'height', 'type'], ['resource-id' => $resource_id], ['order' => ['width']]);
|
||||||
if (!$photo) {
|
if (!$photo) {
|
||||||
if ($r_json) {
|
Logger::warning('Cannot find photo in database', ['resource-id' => $resource_id]);
|
||||||
System::jsonExit(['error' => '']);
|
if ($isJson) {
|
||||||
|
System::jsonExit(['error' => 'Cannot find photo']);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$picture = [];
|
|
||||||
|
|
||||||
$picture["id"] = $photo["id"];
|
$picture = [
|
||||||
$picture["size"] = $photo["datasize"];
|
'id' => $photo['id'],
|
||||||
$picture["width"] = $photo["width"];
|
'size' => $photo['datasize'],
|
||||||
$picture["height"] = $photo["height"];
|
'width' => $photo['width'],
|
||||||
$picture["type"] = $photo["type"];
|
'height' => $photo['height'],
|
||||||
$picture["albumpage"] = DI::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $resource_id;
|
'type' => $photo['type'],
|
||||||
$picture["picture"] = DI::baseUrl() . "/photo/{$resource_id}-0." . $image->getExt();
|
'albumpage' => DI::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $resource_id,
|
||||||
$picture["preview"] = DI::baseUrl() . "/photo/{$resource_id}-{$smallest}." . $image->getExt();
|
'picture' => DI::baseUrl() . "/photo/{$resource_id}-0." . $image->getExt(),
|
||||||
|
'preview' => DI::baseUrl() . "/photo/{$resource_id}-{$smallest}." . $image->getExt(),
|
||||||
|
];
|
||||||
|
|
||||||
if ($r_json) {
|
if ($isJson) {
|
||||||
System::jsonExit(['picture' => $picture]);
|
System::jsonExit(['picture' => $picture]);
|
||||||
}
|
}
|
||||||
Logger::info("upload done");
|
Logger::info('upload done');
|
||||||
return $picture;
|
return $picture;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::info("upload done");
|
Logger::info('upload done');
|
||||||
|
|
||||||
if ($r_json) {
|
if ($isJson) {
|
||||||
System::jsonExit(['ok' => true]);
|
System::jsonExit(['ok' => true]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue