From: Alexander Ebert Date: Tue, 1 Jun 2021 12:10:45 +0000 (+0200) Subject: Helper methods to query the style's cover photo dimensions X-Git-Tag: 5.4.0_Beta_1~4^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3d80691aed03b2f5d6d1d8f45c9506fdaa2d6973;p=GitHub%2FWoltLab%2FWCF.git Helper methods to query the style's cover photo dimensions --- diff --git a/wcfsetup/install/files/lib/data/style/Style.class.php b/wcfsetup/install/files/lib/data/style/Style.class.php index c3ad2e4c96..0fc15e650a 100644 --- a/wcfsetup/install/files/lib/data/style/Style.class.php +++ b/wcfsetup/install/files/lib/data/style/Style.class.php @@ -41,6 +41,16 @@ use wcf\util\ImageUtil; */ class Style extends DatabaseObject { + /** + * @since 5.4 + */ + protected $coverPhotoHeight = 0; + + /** + * @since 5.4 + */ + protected $coverPhotoWidth = 0; + /** * @since 5.4 */ @@ -223,6 +233,15 @@ class Style extends DatabaseObject $this->pageLogoSmallHeight = $data[1]; } } + + $coverPhoto = $this->getCoverPhotoLocation(); + if (\file_exists($coverPhoto)) { + $data = \getimagesize($coverPhoto); + if ($data !== false) { + $this->coverPhotoWidth = $data[0]; + $this->coverPhotoHeight = $data[1]; + } + } } /** @@ -339,6 +358,22 @@ class Style extends DatabaseObject return WCF::getPath() . 'images/coverPhotos/' . $this->getCoverPhoto(); } + /** + * @since 5.4 + */ + public function getCoverPhotoHeight(): int + { + return $this->coverPhotoHeight; + } + + /** + * @since 5.4 + */ + public function getCoverPhotoWidth(): int + { + return $this->coverPhotoWidth; + } + /** * @since 5.4 */