Skip to content

Commit b273540

Browse files
committed
Add method to get a ImageData instance of a cover photo
1 parent ac52912 commit b273540

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

wcfsetup/install/files/lib/system/image/cover/photo/DefaultCoverPhoto.class.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace wcf\system\image\cover\photo;
44

5+
use wcf\system\file\processor\ImageData;
56
use wcf\system\style\StyleHandler;
67
use wcf\util\FileUtil;
78

@@ -81,4 +82,10 @@ public static function getDefaultCoverPhoto(): self
8182

8283
return self::$defaultCoverPhoto;
8384
}
85+
86+
#[\Override]
87+
public function getImageData(?int $minWidth = null, ?int $minHeight = null): ?ImageData
88+
{
89+
return null;
90+
}
8491
}

wcfsetup/install/files/lib/system/image/cover/photo/FileCoverPhoto.class.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace wcf\system\image\cover\photo;
44

55
use wcf\data\file\File;
6+
use wcf\system\file\processor\ImageData;
67

78
/**
89
* Represents a cover photo that is based on a file upload.
@@ -81,4 +82,10 @@ public function getMimeType(?string $size = null): string
8182

8283
return $this->file->mimeType;
8384
}
85+
86+
#[\Override]
87+
public function getImageData(?int $minWidth = null, ?int $minHeight = null): ?ImageData
88+
{
89+
return $this->file->getImageData($minWidth, $minHeight);
90+
}
8491
}

wcfsetup/install/files/lib/system/image/cover/photo/ICoverPhoto.class.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace wcf\system\image\cover\photo;
44

5+
use wcf\system\file\processor\ImageData;
6+
57
/**
68
* Default interface for cover photos that support mulitple sizes.
79
*
@@ -21,4 +23,6 @@ public function getHeight(?string $size = null): int;
2123
public function getFileSize(?string $size = null): int;
2224

2325
public function getMimeType(?string $size = null): string;
26+
27+
public function getImageData(?int $minWidth = null, ?int $minHeight = null): ?ImageData;
2428
}

0 commit comments

Comments
 (0)