X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FUser_group.php;h=344394a682052ef9d8d3203f1e41491002881837;hb=42c653a9d0a57d8b575614827a569badd054e5a7;hp=3dc5fd4b2d8e0e1e799fad943b59301621a05ee3;hpb=c214aa5149df0e0804c362021c209f78b5ee6483;p=quix0rs-gnu-social.git diff --git a/classes/User_group.php b/classes/User_group.php index 3dc5fd4b2d..344394a682 100644 --- a/classes/User_group.php +++ b/classes/User_group.php @@ -33,6 +33,12 @@ class User_group extends Managed_DataObject /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE + public function getObjectType() + { + return ActivityObject::GROUP; + } + + public static function schemaDef() { return array( @@ -312,13 +318,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); } @@ -810,7 +824,7 @@ class User_group extends Managed_DataObject function isPrivate() { return ($this->join_policy == self::JOIN_POLICY_MODERATE && - $this->force_scope == 1); + intval($this->force_scope) === 1); } public function isLocal()