X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FUser_group.php;h=df54b7987c7d7228ca507cd9b842a159b095005a;hb=3255e2e1b81ce6d8d867e924eeacff2c9e53d706;hp=3dc5fd4b2d8e0e1e799fad943b59301621a05ee3;hpb=611e5ab42137fc420bc9089185eff9795e028cc0;p=quix0rs-gnu-social.git diff --git a/classes/User_group.php b/classes/User_group.php index 3dc5fd4b2d..df54b7987c 100644 --- a/classes/User_group.php +++ b/classes/User_group.php @@ -312,13 +312,21 @@ class User_group extends Managed_DataObject function setOriginal($filename) { - $imagefile = new ImageFile($this->id, Avatar::path($filename)); + // This should be handled by the Profile->setOriginal function so user and group avatars are handled the same + $imagefile = new ImageFile(null, Avatar::path($filename)); + + $sizes = array('homepage_logo' => AVATAR_PROFILE_SIZE, + 'stream_logo' => AVATAR_STREAM_SIZE, + 'mini_logo' => AVATAR_MINI_SIZE); $orig = clone($this); $this->original_logo = Avatar::url($filename); - $this->homepage_logo = Avatar::url($imagefile->resize(AVATAR_PROFILE_SIZE)); - $this->stream_logo = Avatar::url($imagefile->resize(AVATAR_STREAM_SIZE)); - $this->mini_logo = Avatar::url($imagefile->resize(AVATAR_MINI_SIZE)); + foreach ($sizes as $name=>$size) { + $filename = Avatar::filename($this->profile_id, image_type_to_extension($imagefile->preferredType()), + $size, common_timestamp()); + $imagefile->resizeTo(Avatar::path($filename), array('width'=>$size, 'height'=>$size)); + $this->$name = Avatar::url($filename); + } common_debug(common_log_objstring($this)); return $this->update($orig); }