public function save($to = null, $append = false)
{
if (null === $this->resource) {
$this->createResource();
}
if (null === $this->output) {
$this->output = $this->resource;
}
$this->createImage($this->output, null === $to ? $this->fullpath : $to, $this->quality);
clearstatcache();
$this->setFile(null === $to ? $this->fullpath : $to);
$imgSize = getimagesize($this->fullpath);
// Set image object properties.
$this->width = $imgSize[0];
$this->height = $imgSize[1];
$this->channels = isset($imgSize['channels']) ? $imgSize['channels'] : null;
return $this;
}