From 031166c1771cff50f4069098031a94a8e8da35c5 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Mon, 2 Sep 2024 10:15:10 +0200 Subject: [PATCH] fix(OCP): Fix Image interface Signed-off-by: provokateurin --- lib/private/Image.php | 4 +--- lib/private/StreamImage.php | 8 ++++++++ lib/public/IImage.php | 20 ++++++++++++++++++++ lib/public/Image.php | 8 +++++++- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/lib/private/Image.php b/lib/private/Image.php index 396246125604f..3dd0bc4966211 100644 --- a/lib/private/Image.php +++ b/lib/private/Image.php @@ -779,9 +779,7 @@ public function loadFromFile($imagePath = false) { } /** - * Loads an image from a string of data. - * - * @param string $str A string of image data as read from a file. + * @inheritDoc */ public function loadFromData(string $str): GdImage|false { if (!$this->checkImageDataSize($str)) { diff --git a/lib/private/StreamImage.php b/lib/private/StreamImage.php index 9290bf38b0f91..34fe590efbd99 100644 --- a/lib/private/StreamImage.php +++ b/lib/private/StreamImage.php @@ -133,4 +133,12 @@ public function preciseResizeCopy(int $width, int $height): IImage { public function resizeCopy(int $maxSize): IImage { throw new \BadMethodCallException('Not implemented'); } + + public function loadFromData(string $str): \GdImage|false { + throw new \BadMethodCallException('Not implemented'); + } + + public function readExif(string $data): void { + throw new \BadMethodCallException('Not implemented'); + } } diff --git a/lib/public/IImage.php b/lib/public/IImage.php index b201754536d2a..7ba08c889dae5 100644 --- a/lib/public/IImage.php +++ b/lib/public/IImage.php @@ -8,6 +8,8 @@ */ namespace OCP; +use GdImage; + /** * Class for basic image manipulation * @since 8.1.0 @@ -202,4 +204,22 @@ public function preciseResizeCopy(int $width, int $height): IImage; * @since 19.0.0 */ public function resizeCopy(int $maxSize): IImage; + + /** + * Loads an image from a string of data. + * + * @param string $str A string of image data as read from a file. + * + * @since 31.0.0 + */ + public function loadFromData(string $str): GdImage|false; + + /** + * Reads the EXIF data for an image. + * + * @param string $data EXIF data + * + * @since 31.0.0 + */ + public function readExif(string $data): void; } diff --git a/lib/public/Image.php b/lib/public/Image.php index a9aab778207bf..84d07d6a4b427 100644 --- a/lib/public/Image.php +++ b/lib/public/Image.php @@ -14,5 +14,11 @@ * This class provides functions to handle images * @since 6.0.0 */ -class Image extends \OC\Image { +class Image extends \OC\Image implements \OCP\IImage { + /** + * @since 31.0.0 + */ + public function __construct() { + parent::__construct(); + } }