Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
* @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;
+ }
}
/**
* @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;
+ }
}
/**
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();