public function resize($width, $height)
{
$this->preModify();
$newImg = $this->createImage($width, $height);
imagecopyresampled($newImg, $this->resource, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());
$this->resource = $newImg;
$this->setWidth($width);
$this->setHeight($height);
$this->postModify();
return $this;
}