* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core\Data\User\Cover\Photo
*/
-class UserCoverPhoto implements IUserCoverPhoto
+class UserCoverPhoto implements IWebpUserCoverPhoto
{
/**
* file extension
) . '/' . $this->userID . '-' . $this->coverPhotoHash . '.' . ($useWebP ? 'webp' : $this->coverPhotoExtension);
}
+ /**
+ * @inheritDoc
+ */
+ public function createWebpVariant()
+ {
+ if ($this->coverPhotoHasWebP) {
+ return;
+ }
+
+ $sourceLocation = WCF_DIR . $this->getFilename($this->coverPhotoExtension === 'webp');
+ $outputFilenameWithoutExtension = \preg_replace('~\.[a-z]+$~', '', $sourceLocation);
+
+ return ImageUtil::createWebpVariant($sourceLocation, $outputFilenameWithoutExtension);
+ }
+
/**
* Returns the minimum and maximum dimensions for cover photos.
*