function Transfer($url){ $url = trim($url); if(!$this->watermark){ return parent::Transfer($url); } else{ //Leech image to host $filePath = $this->tempfolder . $this->sitename . basename($url); $data = fopen($url, "rb"); $newfile = fopen($filePath, "w"); flush(); while ($buff = fread($data, 1024*8)) fwrite($newfile, $buff); fclose($data); fclose($newfile); //Leech complete $this->Watermark($filePath, $this->watermark_file); return parent::Upload($filePath); } }
public function Transfer($url){ if(!$this->watermark){ return parent::Transfer($url, $this->cookie); } else{ //Leech image to host $url = trim($url); $data = fopen($url, "rb"); $filename = $this->sitename . end(explode('/',$url)); $newfile = fopen($this->folder . $filename, "w"); flush(); while ($buff = fread($data, 1024*8)) fwrite($newfile, $buff); fclose($data); fclose($newfile); //Leech complete $this->Watermark($this->folder . $filename, $this->watermark_file); $data = file_get_contents($this->folder . $filename); return parent::Upload($data, $this->sitename . $filename, $this->cookie); } }