]> 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)
committerCôme Chilliet <come.chilliet@nextcloud.com>
Tue, 14 Dec 2021 10:20:13 +0000 (11:20 +0100)
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
lib/private/legacy/OC_Image.php
lib/public/IImage.php

index dcc65af358e3026d52160d9cba1cb8609c7d877d..bbed6e6f671dd466659d1dd35a89a9e1e9c87fe0 100644 (file)
@@ -125,7 +125,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;
+               }
        }
 
        /**
@@ -134,7 +138,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 ea9f6e40190c02e699758cfd15c24f60800f15e0..6ee5377adb7e539eceadd106be1a5d5d25e202c6 100644 (file)
@@ -99,7 +99,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();