Add `IUserCoverPhoto::getThumbnailURL()`
authorCyperghost <olaf_schmitz_1@t-online.de>
Wed, 18 Dec 2024 10:27:00 +0000 (11:27 +0100)
committerCyperghost <olaf_schmitz_1@t-online.de>
Wed, 18 Dec 2024 10:27:00 +0000 (11:27 +0100)
wcfsetup/install/files/lib/data/user/cover/photo/DefaultUserCoverPhoto.class.php
wcfsetup/install/files/lib/data/user/cover/photo/IUserCoverPhoto.class.php
wcfsetup/install/files/lib/data/user/cover/photo/UserCoverPhoto.class.php

index 00ad124e03a51a6b4a710ffe405771c161995546..e63d940f7e6f2517fee2815fe00aa9b3175553f4 100644 (file)
@@ -50,4 +50,10 @@ class DefaultUserCoverPhoto implements IUserCoverPhoto
     {
         return null;
     }
+
+    #[\Override]
+    public function getThumbnailURL(string $size = 'small'): string
+    {
+        return $this->getURL();
+    }
 }
index ce1be6d9dd25b6f7c1f4085e952aa7db407f125b..ada928087f693b1f714837b635ca8b00e19072ae 100644 (file)
@@ -26,6 +26,13 @@ interface IUserCoverPhoto
      */
     public function getURL(?bool $forceWebP = null): string;
 
+    /**
+     * Returns the thumbnail of this cover photo.
+     *
+     * @since 6.2
+     */
+    public function getThumbnailURL(string $size = 'small'): string;
+
     /**
      * Returns the file name of this cover photo.
      */
@@ -33,6 +40,8 @@ interface IUserCoverPhoto
 
     /**
      * Returns the object ID of this cover photo.
+     *
+     * @since 6.2
      */
     public function getObjectID(): ?int;
 }
index 54aec222da51babaa6bcd81136aeab05bfdbd5bc..688b92f76fb6e394c69e668923f50705cf0635c7 100644 (file)
@@ -50,6 +50,14 @@ final class UserCoverPhoto implements IUserCoverPhoto
         return $this->file->getFullSizeImageSource();
     }
 
+    #[\Override]
+    public function getThumbnailURL(string $size = 'small'): string
+    {
+        $thumbnail = $this->file->getThumbnail($size);
+
+        return $thumbnail ? $thumbnail->getLink() : $this->getURL();
+    }
+
     #[\Override]
     public function getFilename(?bool $forceWebP = null): string
     {