Skip to content
This repository has been archived by the owner on May 31, 2019. It is now read-only.

Commit

Permalink
Update Image.php
Browse files Browse the repository at this point in the history
Do not use `clone` because `$this->resource` is not set after cloning (set by constructor).
  • Loading branch information
jbelien committed Apr 1, 2019
1 parent 0df6be0 commit 39b81a0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,19 @@ public function thumbnail(int $maxSize) : self
$this->height
);
} else {
$thumbnail = clone $this;
$thumbnail = new self($this->width, $this->height);
$thumbnail->type = $this->type;

imagecopy(
$thumbnail->resource,
$this->resource,
0,
0,
0,
0,
$this->width,
$this->height
);
}

return $thumbnail;
Expand Down

0 comments on commit 39b81a0

Please sign in to comment.