Skip to content

Commit

Permalink
Fix typing problems in OC_Image
Browse files Browse the repository at this point in the history
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc authored and backportbot[bot] committed Dec 6, 2021
1 parent d2b6733 commit d1e0aee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions lib/private/legacy/OC_Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ public function mimeType() {
* @return int
*/
public function width() {
return $this->valid() ? imagesx($this->resource) : -1;
if ($this->valid() && (($width = imagesx($this->resource)) !== false)) {
return $width;
} else {
return -1;
}
}

/**
Expand All @@ -133,7 +137,11 @@ public function width() {
* @return int
*/
public function height() {
return $this->valid() ? imagesy($this->resource) : -1;
if ($this->valid() && (($height = imagesy($this->resource)) !== false)) {
return $height;
} else {
return -1;
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/public/IImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function show($mimeType = null);
public function save($filePath = null, $mimeType = null);

/**
* @return resource|\GdImage Returns the image resource in any.
* @return false|resource|\GdImage Returns the image resource if any
* @since 8.1.0
*/
public function resource();
Expand Down

0 comments on commit d1e0aee

Please sign in to comment.