Skip to content

Commit

Permalink
Merge pull request #47676 from nextcloud/fix/ocp/image-interface
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin committed Sep 2, 2024
2 parents cbeca43 + 031166c commit 02a6f12
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
4 changes: 1 addition & 3 deletions lib/private/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
8 changes: 8 additions & 0 deletions lib/private/StreamImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
20 changes: 20 additions & 0 deletions lib/public/IImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
*/
namespace OCP;

use GdImage;

/**
* Class for basic image manipulation
* @since 8.1.0
Expand Down Expand Up @@ -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;
}
8 changes: 7 additions & 1 deletion lib/public/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit 02a6f12

Please sign in to comment.