summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2021-12-02 11:30:10 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2021-12-06 14:26:26 +0100
commitab3a1d5706a5cc0c7f00b5d5ab47d493ffe68790 (patch)
tree8d81b02883455bf42389122ae196e25a5e40fc80 /lib
parentd53722636830eb8b5abd3215afa3f4ea07ce65d2 (diff)
downloadnextcloud-server-ab3a1d5706a5cc0c7f00b5d5ab47d493ffe68790.tar.gz
nextcloud-server-ab3a1d5706a5cc0c7f00b5d5ab47d493ffe68790.zip
Fix typing problems in OC_Image
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/legacy/OC_Image.php12
-rw-r--r--lib/public/IImage.php2
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php
index e6a815a3cf7..1b1d98325ba 100644
--- a/lib/private/legacy/OC_Image.php
+++ b/lib/private/legacy/OC_Image.php
@@ -124,7 +124,11 @@ class OC_Image implements \OCP\IImage {
* @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;
+ }
}
/**
@@ -133,7 +137,11 @@ class OC_Image implements \OCP\IImage {
* @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;
+ }
}
/**
diff --git a/lib/public/IImage.php b/lib/public/IImage.php
index 9d2b31e0e28..659cd24720d 100644
--- a/lib/public/IImage.php
+++ b/lib/public/IImage.php
@@ -98,7 +98,7 @@ interface IImage {
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();