Adjusted cover photo sizes, added description on limits
authorAlexander Ebert <ebert@woltlab.com>
Wed, 29 Nov 2017 10:49:46 +0000 (11:49 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 29 Nov 2017 10:49:51 +0000 (11:49 +0100)
See #2484

com.woltlab.wcf/templates/user.tpl
wcfsetup/install/files/lib/data/user/cover/photo/UserCoverPhoto.class.php
wcfsetup/install/files/lib/page/UserPage.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 91ddf303f1824924d5041d80ab2a204e2cad46ec..4056777314b0aa97c72ed06218a021708cadd172 100644 (file)
 {if MODULE_USER_COVER_PHOTO && $user->userID == $__wcf->user->userID}
        {if $__wcf->getSession()->getPermission('user.profile.coverPhoto.canUploadCoverPhoto')}
                <div id="userProfileCoverPhotoUpload" class="jsStaticDialogContent" data-title="{lang}wcf.user.coverPhoto.upload{/lang}">
-                       {lang}wcf.user.coverPhoto.description{/lang}
-                       
                        {if $__wcf->user->disableCoverPhoto}
                                <p class="error">{lang}wcf.user.coverPhoto.error.disabled{/lang}</p>
                        {else}
                                
                                {* placeholder for the upload button *}
                                <div id="coverPhotoUploadButtonContainer"></div>
+                               <small>{lang}wcf.user.coverPhoto.upload.description{/lang}</small>
                        {/if}
                </div>
                <script data-relocate="true">
index fb118d4429261499f337595c2fc07db57fa27b32..84b9df7259cdf92878ddcbd7d0e8406c251c779b 100644 (file)
@@ -29,10 +29,10 @@ class UserCoverPhoto implements IUserCoverPhoto {
         */
        protected $userID;
        
-       const MAX_HEIGHT = 400;
-       const MAX_WIDTH = 1600;
+       const MAX_HEIGHT = 800;
+       const MAX_WIDTH = 2000;
        const MIN_HEIGHT = 200;
-       const MIN_WIDTH = 800;
+       const MIN_WIDTH = 500;
        
        /**
         * UserCoverPhoto constructor.
@@ -76,4 +76,22 @@ class UserCoverPhoto implements IUserCoverPhoto {
        public function getFilename() {
                return substr($this->coverPhotoHash, 0, 2) . '/' . $this->userID . '-' . $this->coverPhotoHash . '.' . $this->coverPhotoExtension;
        }
+       
+       /**
+        * Returns the minimum and maximum dimensions for cover photos.
+        * 
+        * @return      array
+        */
+       public static function getCoverPhotoDimensions() {
+               return [
+                       'max' => [
+                               'height' => self::MAX_HEIGHT,
+                               'width' => self::MAX_WIDTH
+                       ],
+                       'min' => [
+                               'height' => self::MIN_HEIGHT,
+                               'width' => self::MIN_WIDTH
+                       ]
+               ];
+       }
 }
index cf250b503be21d21794981e59b7f5d99bbc2eec5..673553d4f227797edab4968896fe7f019cf4335c 100644 (file)
@@ -2,6 +2,7 @@
 namespace wcf\page;
 use wcf\data\object\type\ObjectType;
 use wcf\data\object\type\ObjectTypeCache;
+use wcf\data\user\cover\photo\UserCoverPhoto;
 use wcf\data\user\follow\UserFollowerList;
 use wcf\data\user\follow\UserFollowingList;
 use wcf\data\user\group\UserGroup;
@@ -162,7 +163,8 @@ class UserPage extends AbstractPage {
                        'followingCount' => $this->followingList->countObjects(),
                        'visitors' => $this->visitorList !== null ? $this->visitorList->getObjects() : [],
                        'visitorCount' => $this->visitorList !== null ? $this->visitorList->countObjects() : 0,
-                       'isAccessible' => UserGroup::isAccessibleGroup($this->user->getGroupIDs())
+                       'isAccessible' => UserGroup::isAccessibleGroup($this->user->getGroupIDs()),
+                       'coverPhotoDimensions' => UserCoverPhoto::getCoverPhotoDimensions()
                ]);
        }
        
index fb12ba8447a3509c131d0adc7e99b3695e21a401..b18c6bc8ca2236941a80a25cd68c399aa341d742 100644 (file)
@@ -3932,6 +3932,7 @@ Die E-Mail-Adresse des neuen Benutzers lautet: {@$user->email}
                <item name="wcf.user.coverPhoto.delete.confirmMessage"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Willst du dein{else}Wollen Sie Ihr{/if} Profilbild wirklich löschen? Nach dem Löschen wird wieder das Standard-Bild angezeigt.]]></item>
                <item name="wcf.user.coverPhoto.edit"><![CDATA[Profilbild bearbeiten]]></item>
                <item name="wcf.user.coverPhoto.upload"><![CDATA[Profilbild hochladen]]></item>
+               <item name="wcf.user.coverPhoto.upload.description"><![CDATA[Minimale Bildgröße: {$coverPhotoDimensions.min.width}×{$coverPhotoDimensions.min.height} Pixel<br>Maximale Bildgröße: {$coverPhotoDimensions.max.width}×{$coverPhotoDimensions.max.height} Pixel<br>Erlaubte Dateiendungen: gif, jpg, jpeg, png<br>Maximale Dateigröße: {$__wcf->session->getPermission('user.profile.coverPhoto.maxSize')|filesize}]]></item>
                <item name="wcf.user.coverPhoto.upload.error.badImage"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} kein gültiges Bild hochgeladen.]]></item>
                <item name="wcf.user.coverPhoto.upload.error.invalidExtension"><![CDATA[Die Datei hat eine ungültige Dateiendung.]]></item>
                <item name="wcf.user.coverPhoto.upload.error.maxHeight"><![CDATA[Das Bild ist zu hoch.]]></item>
index 7ee19d51080ccf5490613bd9eb28fbe5a36bc401..a8ddd0bdf41f6f023e3f0d35e2159504543c4815 100644 (file)
@@ -3924,6 +3924,7 @@ Open the link below to access the user profile:
                <item name="wcf.user.coverPhoto.delete.confirmMessage"><![CDATA[Do you really want to delete your cover photo? This will replace your current photo with the default image.]]></item>
                <item name="wcf.user.coverPhoto.edit"><![CDATA[Edit Cover Photo]]></item>
                <item name="wcf.user.coverPhoto.upload"><![CDATA[Upload Cover Photo]]></item>
+               <item name="wcf.user.coverPhoto.upload.description"><![CDATA[Minimum Image Size: {$coverPhotoDimensions.min.width}×{$coverPhotoDimensions.min.height} pixels<br>Maximum Image Size: {$coverPhotoDimensions.max.width}×{$coverPhotoDimensions.max.height} pixels<br>Allowed File Extensions: gif, jpg, jpeg, png<br>Maximum Filesize: {$__wcf->session->getPermission('user.profile.coverPhoto.maxSize')|filesize}]]></item>
                <item name="wcf.user.coverPhoto.upload.error.badImage"><![CDATA[The uploaded file is not an image.]]></item>
                <item name="wcf.user.coverPhoto.upload.error.invalidExtension"><![CDATA[The file has an invalid extension.]]></item>
                <item name="wcf.user.coverPhoto.upload.error.maxHeight"><![CDATA[The image is too tall.]]></item>