summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
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();