use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
-use Friendica\Database\DBStructure;
use Friendica\DI;
use Friendica\Core\Storage\Type\ExternalResource;
use Friendica\Core\Storage\Exception\InvalidClassStorageException;
*/
private static function getFields(): array
{
- $allfields = DBStructure::definition(DI::app()->getBasePath(), false);
+ $allfields = DI::dbaDefinition()->getAll();
$fields = array_keys($allfields['photo']['fields']);
array_splice($fields, array_search('data', $fields), 1);
return $fields;
}
/**
+ * Returns a float that represents the GPS coordinate from EXIF data
+ *
* @param array $exifCoord coordinate
* @param string $hemi hemi
* @return float
{
$sql_extra = Security::getPermissionsSQLByUserId($uid);
- $avatar_type = (local_user() && (local_user() == $uid)) ? self::USER_AVATAR : self::DEFAULT;
- $banner_type = (local_user() && (local_user() == $uid)) ? self::USER_BANNER : self::DEFAULT;
+ $avatar_type = (DI::userSession()->getLocalUserId() && (DI::userSession()->getLocalUserId() == $uid)) ? self::USER_AVATAR : self::DEFAULT;
+ $banner_type = (DI::userSession()->getLocalUserId() && (DI::userSession()->getLocalUserId() == $uid)) ? self::USER_BANNER : self::DEFAULT;
- $key = 'photo_albums:' . $uid . ':' . local_user() . ':' . remote_user();
+ $key = 'photo_albums:' . $uid . ':' . DI::userSession()->getLocalUserId() . ':' . DI::userSession()->getRemoteUserId();
$albums = DI::cache()->get($key);
if (is_null($albums) || $update) {
*/
public static function clearAlbumCache(int $uid)
{
- $key = 'photo_albums:' . $uid . ':' . local_user() . ':' . remote_user();
+ $key = 'photo_albums:' . $uid . ':' . DI::userSession()->getLocalUserId() . ':' . DI::userSession()->getRemoteUserId();
DI::cache()->set($key, null, Duration::DAY);
}
$r = self::store($image, $user['uid'], 0, $resource_id, $filename, $album, 0, self::DEFAULT, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
if (!$r) {
- Logger::notice('Photo could not be stored');
+ Logger::warning('Photo could not be stored', ['uid' => $user['uid'], 'resource_id' => $resource_id, 'filename' => $filename, 'album' => $album]);
return [];
}
$picture['height'] = $photo['height'];
$picture['type'] = $photo['type'];
$picture['albumpage'] = DI::baseUrl() . '/photos/' . $user['nickname'] . '/image/' . $resource_id;
- $picture['picture'] = DI::baseUrl() . '/photo/{$resource_id}-0.' . $image->getExt();
- $picture['preview'] = DI::baseUrl() . '/photo/{$resource_id}-{$smallest}.' . $image->getExt();
+ $picture['picture'] = DI::baseUrl() . '/photo/' . $resource_id . '-0.' . $image->getExt();
+ $picture['preview'] = DI::baseUrl() . '/photo/' . $resource_id . '-' . $smallest . '.' . $image->getExt();
Logger::info('upload done', ['picture' => $picture]);
return $picture;
$r = self::store($image, $uid, 0, $resource_id, $filename, $album, 4, self::USER_AVATAR);
if (!$r) {
- logger::notice('profile image upload with scale 4 (300) failed');
+ logger::warning('profile image upload with scale 4 (300) failed', ['uid' => $uid, 'resource_id' => $resource_id, 'filename' => $filename, 'album' => $album]);
}
if ($width > 80 || $height > 80) {
$r = self::store($image, $uid, 0, $resource_id, $filename, $album, 5, self::USER_AVATAR);
if (!$r) {
- logger::notice('profile image upload with scale 5 (80) failed');
+ logger::warning('profile image upload with scale 5 (80) failed', ['uid' => $uid, 'resource_id' => $resource_id, 'filename' => $filename, 'album' => $album]);
}
if ($width > 48 || $height > 48) {
$r = self::store($image, $uid, 0, $resource_id, $filename, $album, 6, self::USER_AVATAR);
if (!$r) {
- logger::notice('profile image upload with scale 6 (48) failed');
+ logger::warning('profile image upload with scale 6 (48) failed', ['uid' => $uid, 'resource_id' => $resource_id, 'filename' => $filename, 'album' => $album]);
}
logger::info('new profile image upload ended');
$r = self::store($image, $uid, 0, $resource_id, $filename, $album, 3, self::USER_BANNER);
if (!$r) {
- logger::notice('profile banner upload with scale 3 (960) failed');
+ logger::warning('profile banner upload with scale 3 (960) failed');
}
logger::info('new profile banner upload ended');
return $resource_id;
}
}
-