Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(OCP): Fix Image interface #47676

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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() {
provokateurin marked this conversation as resolved.
Show resolved Hide resolved
parent::__construct();
}
}
Loading