Overhauled user profile header and avatar sizes
authorMarcel Werk <burntime@woltlab.com>
Sun, 24 Jul 2016 21:04:36 +0000 (23:04 +0200)
committerMarcel Werk <burntime@woltlab.com>
Sun, 24 Jul 2016 21:05:48 +0000 (23:05 +0200)
wcfsetup/install/files/lib/system/worker/UserRebuildDataWorker.class.php

index e5574efa64142fab6de1f571dc6928878ecbfb4d..bd628ccad2d26e6331bbf615d1194f2ed61748fc 100644 (file)
@@ -95,10 +95,17 @@ class UserRebuildDataWorker extends AbstractRebuildDataWorker {
                                }
                                
                                if ($width < UserAvatar::AVATAR_SIZE || $height < UserAvatar::AVATAR_SIZE) {
+                                       $adapter = ImageHandler::getInstance()->getAdapter();
+                                       $adapter->loadFile($avatar->getLocation());
+                                       $adapter->resize(0, 0, $width, $height, UserAvatar::AVATAR_SIZE, UserAvatar::AVATAR_SIZE);
+                                       $adapter->writeImage($adapter->getImage(), $avatar->getLocation());
+                                       $width = $height = UserAvatar::AVATAR_SIZE;
                                }
                                
                                $editor = new UserAvatarEditor($avatar);
                                $editor->update([
+                                       'width' => $width,
+                                       'height' => $height
                                ]);
                        }
                }