public function __destruct() { if (is_resource($this->gdResource)) { imagedestroy($this->gdResource); } }