]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix typing problems in OC_Image
authorCôme Chilliet <come.chilliet@nextcloud.com>
Thu, 2 Dec 2021 10:30:10 +0000 (11:30 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Mon, 6 Dec 2021 14:22:05 +0000 (14:22 +0000)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
lib/private/legacy/OC_Image.php
lib/public/IImage.php

index e6a815a3cf7e2436d4c2c88c7a70b0bd4715e0eb..1b1d98325baadd1522171bd61be82cd7b54c3cbf 100644 (file)
@@ -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;
+               }
        }
 
        /**
index 9d2b31e0e2868d145320f3c1335b403f205c6eb9..659cd24720d7ce5031f0b15cf7bb83f6b56d5e78 100644 (file)
@@ -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();