public function forceDownload()
    {


        if ($this->type == "jpg")

    {
            $this->toJpg();

        } elseif ($this->type == "png") {

            $this->toPng();

        } elseif ($this->type == "gif") {

            $this->toGif();
        }

        header('Content-Description: File Transfer');
        header("Content-Type: application/octet-stream");
        header('Content-Length: ' . filesize($this->path));
        header('Content-Disposition: attachment; filename="' . basename($this->path.'"'));
        readfile($this->path);

        //remove the temp file
        unlink($this->path);

    }