X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FPhoto.php;h=c622421cc039e74d0bd298284a26cf8471fd65f2;hb=64cea5ce43fef4291f154a230d86e3cd93d621bc;hp=a2c69f994c0f8444d96e9d505711d083c36bc9dd;hpb=dc366bf1f7b5b7b0fc1c1a86772783074b301993;p=friendica.git diff --git a/src/Model/Photo.php b/src/Model/Photo.php index a2c69f994c..c622421cc0 100644 --- a/src/Model/Photo.php +++ b/src/Model/Photo.php @@ -12,8 +12,8 @@ use Friendica\Core\L10n; use Friendica\Core\System; use Friendica\Database\DBM; use Friendica\Object\Image; +use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; -use Friendica\Util\Temporal; use dba; require_once 'include/dba.php'; @@ -55,8 +55,8 @@ class Photo 'contact-id' => $cid, 'guid' => $guid, 'resource-id' => $rid, - 'created' => Temporal::convert(), - 'edited' => Temporal::convert(), + 'created' => DateTimeFormat::utcNow(), + 'edited' => DateTimeFormat::utcNow(), 'filename' => basename($filename), 'type' => $Image->getType(), 'album' => $album, @@ -91,13 +91,16 @@ class Photo */ public static function importProfilePhoto($image_url, $uid, $cid, $quit_on_error = false) { + $thumb = ''; + $micro = ''; + $photo = dba::selectFirst( 'photo', ['resource-id'], ['uid' => $uid, 'contact-id' => $cid, 'scale' => 4, 'album' => 'Contact Photos'] ); if (x($photo['resource-id'])) { $hash = $photo['resource-id']; } else { - $hash = photo_new_resource(); + $hash = self::newResource(); } $photo_failure = false; @@ -264,4 +267,14 @@ class Photo $key = "photo_albums:".$uid.":".local_user().":".remote_user(); Cache::set($key, null, CACHE_DAY); } + + /** + * Generate a unique photo ID. + * + * @return string + */ + public static function newResource() + { + return get_guid(32, false); + } }