From e4ed5ed264bf660b893e18d85775f9b08c133564 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 23 Jan 2021 21:45:20 +0100 Subject: Do not store multiple profile images thumbnails --- include/photo/photo_driver.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index f61919eea..542d932f6 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -401,8 +401,17 @@ function import_channel_photo($photo, $type, $aid, $uid) { logger('Importing channel photo for ' . $uid, LOGGER_DEBUG); + $r = q("SELECT resource_id FROM photo WHERE uid = %d AND photo_usage = %d AND imgscale = %d", + intval($uid), + intval(PHOTO_PROFILE), + intval(PHOTO_RES_PROFILE_300) + ); + if ($r) + hash = $r[0]['resource_id']; + else + $hash = photo_new_resource(); + $photo_failure = false; - $hash = photo_new_resource(); $filename = $hash; $img = photo_factory($photo, $type); -- cgit v1.2.3