Skip cover photos that cannot be read
authorAlexander Ebert <ebert@woltlab.com>
Wed, 18 Aug 2021 16:37:11 +0000 (18:37 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 18 Aug 2021 16:37:11 +0000 (18:37 +0200)
wcfsetup/install/files/lib/data/user/cover/photo/UserCoverPhoto.class.php

index 30c68c9d75f23744c0e89d8b72a5bc998ce99d74..eaf521380bc994d85060e0977bec635c85b2847e 100644 (file)
@@ -114,7 +114,11 @@ class UserCoverPhoto implements IWebpUserCoverPhoto
             return;
         }
 
-        $sourceLocation = WCF_DIR . 'images/coverPhotos/' . $this->getFilename($this->coverPhotoExtension === 'webp');
+        $sourceLocation = $this->getLocation($this->coverPhotoExtension === 'webp');
+        if (!\is_readable($sourceLocation)) {
+            return;
+        }
+        
         $outputFilenameWithoutExtension = \preg_replace('~\.[a-z]+$~', '', $sourceLocation);
 
         return ImageUtil::createWebpVariant($sourceLocation, $outputFilenameWithoutExtension);